我如何查看NSError?
什么是最好的方式来logging一个NSError ? 
 - (void)checkThing:(Thing *)thing withError:(NSError *)error { NSLog(@"Error: %@", error); } 
 给我一个null消息 
看看NSError文档告诉我,你需要做一些事情:
 NSLog(@"%@",[error localizedDescription]); 
这应该给你人类可读的输出
NSLog(@"Error: %@", error);给我一个空的消息
 那么error是nil ,不是一个NSError实例。 
以下是我在开发时用于logging错误的一个粗略方法; (不cocoa触摸)
 // Execute the fetch request put the results into array NSError *error = nil; NSArray *resultArray = [moc executeFetchRequest:request error:&error]; if (resultArray == nil) { // Diagnostic error handling NSAlert *anAlert = [NSAlert alertWithError:error]; [anAlert runModal]; } 
NSAlert负责显示错误。