在过去的10个小时里一直试图调试崩溃,最后,我把它简化为这段代码:
NSError *error = nil;
NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"payload" ofType:@"txt"]];
id obj = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
使用NSZombieEnabled,这会在第三行(解析发生的地方)崩溃应用程序并记录:
*** -[CFString retain]: message sent to deallocated instance 0x758afa0
内容payload.txt是:
[
   {
      "created_at":"2013-02-15T23:46:02-05:00",
      "description":"Take out the Big Gun sounded simple enough, except the Strogg were waiting. You, and a few marines like you, are the lucky ones. You've made it down in one piece and are still able to contact the fleet. The Gravity Well, the Strogg's …