【发布时间】:2012-09-25 07:17:10
【问题描述】:
收到 exc_bad_access 错误后,我阅读了本教程:http://www.ioslearner.com/debugging-exc_bad_access-error-xcode-instruments/ 并按照以下步骤操作:
- 运行配置文件
- 选择僵尸
除了没有收到 Zomie 信号之外,我的计算机上的一切看起来都一样。
为了确保我没有忘记某个步骤,我使用教程中提供的示例代码进行了尝试。在那里我看到了僵尸信号
那么如何使用 Xcode -> Profile 在我的项目中获取僵尸信号?
这是我使用的示例代码:
我很清楚这两个版本会导致错误。同样的问题是如何使用 Xcode 在配置文件中获取“僵尸消息”:
NSArray *currentRestaurant = [restaurants objectAtIndex:i];
RestauInfo *restauInfo = [NSEntityDescription
insertNewObjectForEntityForName:@"RestauInfo"
inManagedObjectContext:context];
[restauInfo release];
restauInfo.Name = [currentRestaurant objectAtIndex:0];
restauInfo.Cuisine = [currentRestaurant objectAtIndex:1];
NSError *error;
if (![context save:&error]) {
NSLog(@"Whoops, couldn't save: %@", [error localizedDescription]);
}
[restauInfo release];// - this release would cause an EXC_BAD_ACCESS
另一个问题是:为什么我在第二个版本时会得到 bad_access - 而不是在第一个版本后访问 restauInfo 时?
【问题讨论】:
-
您能发布有关您的崩溃的错误报告吗?它通常会提供您的应用程序的回溯,以便您可以准确追踪出错的位置!
-
如何获取错误报告?如果您指的是左侧的堆栈跟踪,那么:我确实看到了我的一些类,因为我两次调用 release。但问题是我如何使用个人资料获取“僵尸消息”
-
在没有调试器的情况下运行它,因此甚至没有 xcode。它会说“这个应用程序意外停止”,点击详细信息就可以了。
标签: xcode debugging exc-bad-access profile