Reputation: 17303
I have the following:
NSURL *apiURL = [NSURL URLWithString:apiURLString];
NSData *apiResult = [NSData dataWithContentsOfURL:apiURL];
How do I fire some code only after the loading is complete? In case it helps, the code I'm trying to execute at that point is a NSNotificationCenter
notification.
Upvotes: 2
Views: 1062
Reputation: 34945
The dataWithContentsOfURL
method blocks until it has finished loading the data. So you can just add your code at the end of the snippet you showed.
Upvotes: 6