Vij*_*jay 6 multithreading objective-c ios
我正在使用Web服务创建聊天应用程序.在这里,我将调用Web服务,在接收消息后,我必须在表视图中显示它们,我发送的任何内容也必须在表视图中显示.为此,我放置了UIText上方(上方)表视图的字段和我输入的任何内容和按下发送按钮消息显示在表中,并且每30秒后我调用get message service(对于这个我使用的带有定时器的线程)并且在从服务器接收消息之后reloaddata调用表视图中的所有数据显示,当键盘不可见但是当键盘出现并等待服务器响应时重新加载数据我的应用程序崩溃并提供以下错误消息时这种情况正常.
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.
Run Code Online (Sandbox Code Playgroud)
Vij*_*jay 19
我的问题是解决我试图通过辅助线程在表视图中重新加载数据.
所以这就是我做的
[self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:NO]; And My problem is solved
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6179 次 |
| 最近记录: |