Here is my code:
#ifdef DEBUG
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"ERROR" message:@"JSON Parsing Error" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
#endif
This code is executed in a background thread (responsible for parsing), and the error only happens every other time. Any idea on what is the problem here?
Dont mess with the UI from the background thread. Create a method and call that method on the main thread: