为什么这个带有nsjsonserialization的代码总是在实际设备上运行时崩溃。在模拟器

时间:2017-05-30 15:42:37

标签: objective-c json nsstring nsdata nsjsonserialization

enter image description here请参阅相同的问题here

我只是在实际设备上测试时才遇到崩溃。模拟器工作正常。请帮忙

-(void)setFormatForAnswer:(NSDictionary*)answerDict withJsonString:(NSString*)json{ 
NSData *jsonDatanew = [NSJSONSerialization dataWithJSONObject:     [answerDict copy] options:0 error:nil]; 
NSString *jsonnew = [[NSString alloc] initWithData:jsonDatanew encoding:NSUTF8StringEncoding]; 
answerTobeReplacedInDB = jsonnew;
NSDictionary *answersDict = @{@"answers_json":json};
parameters = @{@"survey_answer":answersDict};

[self submitSurveyAnswer];  }

0 个答案:

没有答案