inline UnityAppController* GetAppController()
{
return (UnityAppController*)[UIApplication sharedApplication].delegate;
}
上面的行给出了错误:
[UI Application Delegate]必须仅从主线程调用
如何解决此问题?
答案 0 :(得分:0)
使用主线程:
夫特:
DispatchQueue.main.async {
let appController = GetAppController()
}
目标-C:
dispatch_async(dispatch_get_main_queue(), ^{
UnityAppController* appController = GetAppController();
});