美文网首页
IOS真机切换UI界面时,出现“Only run on the

IOS真机切换UI界面时,出现“Only run on the

作者: 缘來諟夢 | 来源:发表于2020-11-17 16:17 被阅读0次

[[[YXGSDK sharedInstance] GetViewController] presentViewController:ForgotPasswdV2 animated:NO completion:nil];

真机环境下,UI的处理必须是单线程的,所以当 在一个已存在的UI上切换新的UI时,会出现Only run on the main thread 错误。告诉你,只能在主线程上运行。

那么解决方法是:
dispatch_async(dispatch_get_main_queue(), ^{

                        [[[YXGSDK sharedInstance] GetViewController] presentViewController:ForgotPasswdV2 animated:NO completion:nil];

                    });

哈哈,在单线程里就可以啦~

相关文章

网友评论

      本文标题:IOS真机切换UI界面时,出现“Only run on the

      本文链接:https://www.haomeiwen.com/subject/fgaxiktx.html