NSDictionary dictionaryWithObjectsAndKeys
NSDictionary *parmDic = [NSDictionary dictionaryWithObjectsAndKeys:self.objClass.appId,@"appId", self.objClass.cityCd,@"cityCd", self.objClass.channelID,@"channelId", 1,@"currentPage", 1,@"pageSize",nil]; NSDictionary *parmDic = [NSDictionary dictionaryWithObjectsAndKeys:@"SZ100",@"appId", @"苏州",@"cityCd",@"123",@"modelCd", 1,@"channelId", 1,@"currentPage", 1,@"pageSize",nil];
网络传参,走到这一步就挂了,报
EXC_BAD_ACCESS ,90%的错误来源在于对一个已经释放的对象进行release操作。
于是改成下面那样也不行,继续查,才知道是
dictionaryWithObjectsAndKeys方法在遇到nil对象时,会以为是最终的结束标志。
见,
http://www.cocoachina.com/bbs/read.php?tid-124307.html
最后就改成这样,才通过:
NSMutableDictionary* parmDic = [NSMutableDictionary dictionary]; [parmDic setValue:self.objClass.appId forKey:@"appId"]; [parmDic setValue:self.objClass.cityCd forKey:@"cityCd"]; [parmDic setValue:self.objClass.modelCd forKey:@"modelCd"]; [parmDic setValue:self.objClass.channelID forKey:@"channelID"]; [parmDic setValue:@(self.page) forKey:@"currentPage"]; [parmDic setValue:@(self.pageSize) forKey:@"pageSize"];
时间: 2024-12-29 14:50:31