我遇到了一个错误
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
代码 NSString *tokenString=[NSString stringWithFormat:@"username=%@&password=%@",[[userName.text lowercaseString] MD5],[password.text MD5]];
我正在为 MD5 使用类文件。我从MD5得到的
这个 md5 导致线程锁定我如何删除这个警告
最佳答案
当您从辅助线程调用 UIKit 时会发生这种情况...
要解决此问题,请尝试以下操作
dispatch_sync(dispatch_get_main_queue(), ^{
//Call the function from here
});
或
[self performSelectorOnMainThread:@selector(yourmethod:)withObject:obj waitUntilDone:YES]
关于iphone - 从主线程或网页线程以外的线程获取网页锁。不应从辅助线程调用 UIKit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16330773/