views:

76

answers:

1

Hi Guys, My app worked ok on iPhone SDK 3.1. However, when I try to run it in 3.2 simulator, I get the following error and it crashes:

bool _WebTryThreadLock(bool), 0x5148280: 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... Program received signal: “EXC_BAD_ACCESS”.

When I debug it, it leads me to this peace of code:

- (void)LoginViewToCheckView:(id)sender {
CheckViewController *tempTestController = [[CheckViewController alloc] initWithStyle:UITableViewStyleGrouped];
[tempTestController setDelegate:self];
[self setCheckViewController: tempTestController];
[tempTestController release];

[navigationController pushViewController:checkViewController animated:YES];}

Other thing worth mentioning is maybe that I am calling this function from a separate thread.

Any ideas what could be wrong?

+2  A: 

Exactly that: you're accessing UIKit objects from another than the main thread. You cannot push a view controller on a background thread.

You might consider using NSObject's -[performSelectorOnMainThread:withObject:waitUntilDone:] to execute this method on the main thread.

And, b.t.w. methods start with a lowercase letter in Objective-C.

Nikolai Ruhe