1
我使用这个代码(从iphone Core Data Unresolved error while saving)以打印NSError对象的更详细的描述:印刷USERINFO抛出EXC_BAD_ALLOC
- (NSString*)debugDescription
{
NSMutableArray* errorLines = [NSMutableArray array];
[errorLines addObject:[NSString stringWithFormat:@"Failed to save to data store: %@", [self localizedDescription]]];
NSArray* detailedErrors = [[self userInfo] objectForKey:NSDetailedErrorsKey];
if (detailedErrors != nil && [detailedErrors count] > 0)
{
for (NSError* detailedError in detailedErrors)
{
// The following line crashes the app
[errorLines addObject:[NSString stringWithFormat:@" DetailedError: %@", [detailedError userInfo]]];
}
}
else
{
[errorLines addObject:[NSString stringWithFormat:@" %@", [self userInfo]]];
}
return [errorLines description];
}
的问题是,每当我试图访问嵌套的NSError的userInfo对象,该应用程序与EXC_BAD_ALLOC崩溃。
当我创建一个新的NSManagedObject并使用数据填充它时,会生成有问题的错误。我在对象上分配的所有属性都保留分配给它们的所有属性,但似乎没有正确保留某些内容。
我该如何追踪? NSZombieEnabled没有告诉我任何有用的东西。
跑到完全相同的错误,感谢您张贴此 – Mortoc 2011-08-28 23:00:11