解決方案來源:
Xcode 9 的 Main Thread Checker
簡單的說如果在 Thread中 要呼叫另一個畫面
要使用 DispatchQueue.main.async 方法
Main Thread Checker: UI API called on a background thread: -[UIButton setImage:forState:] PID: 1284, TID: 896227, Thread name: (none), Queue name: com.apple.root.default-qos.overcommit, QoS: 0
DispatchQueue.main.async
{
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let ShowVc = storyBoard.instantiateViewController(withIdentifier: "ShowVcId") as! TShowVc
ShowVc.TitleStr = Title
self.present( ShowVc, animated: true, completion: nil)
}
沒有留言:
張貼留言