WebTryThreadLock

I am creating a chat application using web services. Here I am going to call the web services, and after receiving the messages I have to show them in a table, and everything that I send should also be displayed in a table. To do this, I placed the UIText field above the table at the top (top side) and everything I type in and click on the send button message in the table, and every 30 seconds I call the message service (for this I used a stream with a timer) and after receiving a message from the server reloaddata causes all data readings in the table view, it’s fine when the keyboard is not visible, but when the keyboard types a word and waits for the server to respond when I restart the data that my applications encountered, and gives the 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. 
+6
source share
2 answers

My problem is the solution. I tried to reload the data as a table through a secondary stream.

so that's what i did

  [self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:NO]; And My problem is solved 
+19
source

I had this problem until you need to cancel the keyboard for the text box .. because it is trying to load the view while the keyboard is still visible.

 [thetextfield resignFirstResponder]; 
+4
source

Source: https://habr.com/ru/post/895675/


All Articles