I\'m coding up various routines and I\'m trying my best to keep it neat and refactored.
Methods I\'m creating are starting to look similar to this code:
I think that none of the answers presented here are taking into account Apple's recommended practices.
Basically you should never check for the NSError
object to determine if there was a problem. You check if there was a problem by checking the value returned from the method that takes a pointer to a pointer to an NSError
.
From the Apple documentation:
Important Success or failure is indicated by the return value of the method. Although Cocoa methods that indirectly return error objects in the Cocoa error domain are guaranteed to return such objects if the method indicates failure by directly returning
nil
orNO
, you should always check that the return value isnil
orNO
before attempting to do anything with theNSError
object.