If I get an error code result from a Cocoa function, is there any easy way to figure out what it means (other than by grepping through all the .h files in the framework bundles)?
+10
A:
You should look at the <Framework/FrameworkErrors.h>
header for whatever framework the method you're using that's returning an error comes from.
For example, an NSError
in the Cocoa domain that you get from a method in the Foundation framework will have its code
property described in the <Foundation/FoundationErrors.h>
header. Similarly with AppKit and <AppKit/AppKitErrors.h>
and Core Data and <CoreData/CoreDataErrors.h>
.
Also, if you print the description of the NSError
in the debugger, it should include not only the error domain and code, but also the name of the actual error code constant so you can look it up in the API reference.
Chris Hanson
2008-09-01 21:54:46