Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebTryThreadLock

I am creating chat app by using web services. Here I am going to call web services and after receiving messages I have to show them in a table view also whatever I send also must be shown in table view. For this I placed UIText field above (upper side)table view and whatever I type & press send button message shows in table and after every 30 seconds I am calling get message service (for this i used thread with timer)and after receiving messages from server reloaddata calls all data shows in table view this is going fine when keyboard not visible but when keyboard comes upword and wait for server response while reload data my apps crash and gives following error messages.

void _WebThreadLockFromAnyThread(bool), 0xc849490: 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.
bool _WebTryThreadLock(bool), 0xc849490: 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.
like image 233
Vijay Avatar asked Aug 23 '11 12:08

Vijay


2 Answers

My Problem is Solve i was trying to reload data in table view through secondary thread .

so here's what I did

 [self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:NO]; And My problem is solved 
like image 118
Vijay Avatar answered Oct 15 '22 07:10

Vijay


i had this problem before You need to resign the keyboard for the textfield.. because it try's load a view while the keyboard is still visible.

[thetextfield resignFirstResponder];
like image 31
Oblieapps Avatar answered Oct 15 '22 05:10

Oblieapps