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.
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
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];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With