I attempted to make -[NSString stringWithContentsOfURL:encoding:error:] asynchronous, by running it a-synchronically from a background thread:
__block NSStri
-(void)loadappdetails:(NSString*)appid {
NSString* searchurl = [@"https://itunes.apple.com/lookup?id=" stringByAppendingString:appid];
[self performSelectorInBackground:@selector(asyncload:) withObject:searchurl];
}
-(void)asyncload:(NSString*)searchurl {
NSURL* url = [NSURL URLWithString:searchurl];
NSError* error = nil;
NSString* str = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&error];
if (error != nil) {
NSLog(@"Error: %@", error);
}
NSLog(@"str: %@", str);
}