I'm building an iPhone app in which I retrieve data from a .json file on a web site and parse it into a some UITextField view in the main view. I want to check when the data is retrieved so that I can then remove the UIActivityIndicator from the screen.
This is the snippet of code I want to check on when it's complete, it's in viewWillAppear:
//if a connection is available... get and load the infor via .json
if (connection){
dispatch_async(kBgQueue, ^{
NSData* data = [NSData dataWithContentsOfURL:
kLatestGigsURL];
[self performSelectorOnMainThread:@selector(fetchedData:)
withObject:data waitUntilDone:YES];
});
}
Is it possible to check if the data has been fetched? If so how do I do this?
Thanks for reading!