I get the following error, and i have no clue how to avoid it, can someone please help me
bool _WebTryThreadLock(bool), 0x1ea990: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now…
- (void)loadImg {
NSData* image = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://images.sugarscape.com/userfiles/image/DECEMBER2010/Lozza/HarryStyles2.jpg"]];
UIImage* img = [[UIImage alloc] initWithData:image] ;
[self performSelectorInBackground:@selector(showImg:) withObject:img];
}
Don’t call any UIKit methods from threads other than the main thread.
performSelectorInBackground:withObject:executesshowImg:on a secondary thread, and if you call any UIKit methods there, that might be the problem.It is actually explained in plain English: