似乎是NSData的问题,用排除法分析了一下
NSString *urlStr = [NSString stringWithFormat:@"%@/config/AppConfig.json",*******];
[NetRequestHelp createNetRequestWithURL:urlStr parameters:nil requestType:CYRequestMethodTypeGET responseSeializerType:CYResponseSeializerTypeData completionHandle:^(BOOL success, id responseObject, NSString *message) {
if(success)
{
NSDictionary *configDic = [JSONHelp JSONObjectWithData:responseObject];//当此处的responseObject为空的时候,就会报上面错误
[configDic writeToFile:APP_CONFIG atomically:YES];
} else {
}
}];
此时在if(success){ }里面再加一层判断即可避免报上述错误
if(responseObject == null) {
NSDictionary *configDic = [JSONHelp JSONObjectWithData:responseObject];//当此处的responseObject为空的时候,就会报上面错误
[configDic writeToFile:APP_CONFIG atomically:YES];
} else {
}