Closed twprzybysz closed 8 years ago
@brunofarache This caused us some headache back in March and I'm surprised that this bug fix hasn't been pulled into master yet.
Apple doc is pretty clear about this:
When dealing with errors passed by reference, it’s important to test the return value of the method to see whether an error occurred, as shown above. Don’t just test to see whether the error pointer was set to point to an error.
Just started reviewing :)
:octocat: Sent from GH.
This has been merged, thanks!
During development, I've encountered problem which resulted that application does nothing. After investigation I've discovered that dataWithJSONObject returns error and the valid object. Apple in docs suggest to check returned object, instead of checking error which can be anything. I've discovered couple files where simmilar pattern is used, but this is most valuable place which can be affected by any api call.
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/ErrorHandling/ErrorHandling.html http://stackoverflow.com/questions/25558442/can-reusing-the-same-nserror-object-be-problematic