I would like to set the value of an NSData
object within my block. Can someone let me know what I have done wrong here?
// Data
__block NSData *
performRequestWithUrl:xmlString:completionHandler:
is not a synchronous method. It sets up an asynchronous request and then immediately returns. The rest of your method runs and returns.
When the request completes, only then does it run your block, which assigns data
and then immediately throws it away.
Were this a synchronous method, your routine would block pending an expensive network operation. Were this on the main thread, your entire app would hang. ZSURLConnection
(and NSURLConnection
) is designed to avoid that.