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)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
NSErrorin the Cocoa domain that you get from a method in the Foundation framework will have itscodeproperty 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
NSErrorin 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.