Breaking News
Home / iOS / iOS Isuses / WebTryThreadLock – Crashes iPhone App

WebTryThreadLock – Crashes iPhone App

Issue

2012-10-22 22:24:10.089 Raymond[65000:19f23] bool _WebTryThreadLock(bool), 0x8d59090: 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…
1   WebThreadLock
2   -[UITextRangeImpl isEmpty]3   -[UITextRange(UITextSelectionAdditions) _isCaret]4   -[UITextSelectionView setCaretBlinks:]5   -[UIKeyboardImpl setCaretBlinks:]6   -[UIKeyboardImpl setDelegate:force:]7   -[UIKeyboardImpl setDelegate:]8   -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]9   -[UINavigationController navigationTransitionView:didStartTransition:]10  -[UINavigationTransitionView transition:fromView:toView:]11  -[UINavigationTransitionView transition:toView:]12  -[UINavigationController _startTransition:fromViewController:toViewController:]13  -[UINavigationController _startDeferredTransitionIfNeeded]14  -[UINavigationController pushViewController:transition:forceImmediate:]15  -[UINavigationController pushViewController:animated:]16  -[LoginViewController sendRequest]17  -[NSObject performSelector:withObject:]18  -[MBProgressHUD launchExecution]19  -[NSThread main]20  __NSThread__main__<!>

Solution

This can happen if your app is trying to execute an operation e.g. invoke a webservice within a secondary thread but you are trying to update the UIKit component e.g. UITextField from the secondary thread rather the main thread itself. In order to avoid this store the result or any updates into variables and send a notification to the main thread to update the GUI as required thus avoiding this locking issue.

[pb_builder]

Check Also

local variable ‘build_data’ referenced before assignment : TestFlight Error : Failed to upload build.

Scenario Trying to upload build to TestFlight fails in the end. Error local variable ‘build_data’ …

Advertisment ad adsense adlogger