0
void _WebThreadLockFromAnyThread(bool), 0x205acdf0: Obtaining the web lock from a thread other than the main thread or the web thread. UIKit should not be called from a secondary thread.

真剣な表情です。その時点でプログラムを中断したい。メインスレッドの外から UIKit にアクセスしたとは感じません。

ただし、警告はそこにあり、コードのどこで発生するかわかりません

4

1 に答える 1

2

This means your code is called from non-main thread at some point. The problem is you don't remember or don't know where. You just feel you didn't but actually your code does.

My recommendation is heavy dynamic assertion. Install thread-check assertion on every suspicious methods and functions. For example,

- (void)test
{
   NSAssert([[NSThread currentThread] isMainThread], @"This code is expected to be called from main thread!");
}

And then the assertion will eventually make your app to crash on invalid thread context. If you're not that lucky, you may install the assertion on every method literally.

Anyway once you got the assertion failure, you can start at there. And if you found the bad point, following steps are just trivial.

于 2013-03-14T10:42:40.813 に答える