标签:
When methods return an error parameter by reference, check the returned value, not the error variable.
Preferred:
NSError *error = nil;
if (![self trySomethingWithError:&error]) {
// Handle Error
}
Moreover, some of Apple‘s APIs write garbage values to the error parameter (if non-NULL) in successful cases, so checking the error can cause false negatives (and subsequently crash).
标签:
原文地址:http://www.cnblogs.com/memorecool/p/4198237.html