Initializing the error object to nil avoid having garbage set in the object (code 0).
When no error occur, NSData doesn't override the error object to nil, so it was making the following condition check to fail.
Also separated the different condition check (error, no data) to get better log.
Initializing the error object to
nil
avoid having garbage set in the object (code 0). When no error occur, NSData doesn't override theerror
object to nil, so it was making the following condition check to fail.Also separated the different condition check (error, no data) to get better log.