Swift UIAlertController导致Autolayout引擎警告

时间:2016-02-11 17:30:51

标签: ios swift uialertcontroller

出于某种原因,一旦我提出并解散了UIAlertController,我的后续导航将导致很多Autolayout Engine警告,如下所示:

  

2016-02-11 12:22:33.389 MyAppName [19989:13348136]此应用程序是   从后台线程修改autolayout引擎,可以   导致引擎损坏和奇怪的崩溃。这将导致   未来版本中的例外情况。筹码:( 0 CoreFoundation
  0x000000010a708f45 __exceptionPreprocess + 165 1 libobjc.A.dylib
  0x000000010c654deb objc_exception_throw + 48 2 CoreFoundation
  0x000000010a708e7d + [NSException raise:format:] + 205 3 Foundation   0x000000010aea2289 _AssertAutolayoutOnMainThreadOnly + 79 4
  基金会0x000000010ad024e2 - [NSISEngine   优化] + 49 5基础
  0x000000010ad02da4 - [NSISEngine withBehaviors:performModifications:] +   245 6 UIKit 0x000000010b1f0d4a    - [UIView(Hierarchy)_postMovedFromSuperview:] + 575 7 UIKit 0x000000010b1eed53 __UIViewWasRemovedFromSuperview + 213 8 UIKit
  0x000000010b1ee905 - [UIView(Hierarchy)removeFromSuperview] + 422 9
  MyAppName 0x000000010a48586b   _TFFC10PeterPiper18AutoFetchImageView19setRelativeFilePathFS0_FTGSqSS_10completionGSqFT_T___T_U_FTGSqCSo7UIImage_GSqCSo7NSError_GSqSb__T_   + 395

我的代码就像

        let alert = UIAlertController(title: "Some Title", message: nil, preferredStyle: .Alert)
        let action = UIAlertAction(title: "OK", style: .Default, handler: nil)
        alert.addAction(action)

        self.presentViewController(alert, animated: true, completion: nil)

我四处搜索并尝试将代码放在主线程上的dispatch_async块中,这是关于堆栈溢出的许多不同讨论的建议,但我仍然得到相同的错误。任何帮助将不胜感激。

0 个答案:

没有答案