我有一个登录视图页面,一旦登录经过验证,该页面应过渡到选项卡视图控制器。但是,在session.dataTask
中实例化视图时出现错误。[24249:381955] [Animation] +[UIView setAnimationsEnabled:] being called from a background thread. Performing any operation from a background thread on UIView or a subclass is not supported and may result in unexpected and insidious behavior.
哪个会导致
terminating with uncaught exception of type NSException
从服务器进行验证后,如何验证用户并将其带到主页?
答案 0 :(得分:2)
这是因为您不应该在后台线程上执行该操作。
将实例化代码移入主线程
DispatchQueue.main.async {
// view instantition here.
}