解雇时UIAlertView警告

Pin*_*ton 11 warnings uialertview dismiss sprite-kit skscene

我正在以下列方式创建警报:

let alert = UIAlertView(title: "Network Unavailable",
                      message: "Oh noes!",
                     delegate: nil,
            cancelButtonTitle: "OK")
alert.show()
Run Code Online (Sandbox Code Playgroud)

工作良好.但是当我点击"确定"按钮关闭警报时,我得到了这个:

警告:正在进行演示或解除时,尝试从视图控制器<_UIAlertShimPresentingViewController:0x16ea2230>中解除!

一些背景:

  1. 警报是在SKScene的didMoveToView(view:SKView!)函数中创建的.
  2. 这是在Xcode 6 beta 3中.
  3. 我的例子很快,但这也是从Objective-C发生的

有什么想法可能会发生这种警告?如果它在未来的iOS版本中变成致命错误,我不想忽略它.

UPDATE

我还应该补充一点,当警报出现时,当我选择Debug - > View Debugging - > Capture View Hierarchy时,警报不会显示在视图的3d视图中.我想知道这是否是我做错了的症状.

dia*_*nna 5

我得到了同样的警告:

警告:正在进行演示或解雇时,尝试从视图控制器<_UIAlertShimPresentingViewController:>中解除!

在iOS8中,UIAlertController取代了UIAlertView.这应该解决你的警告(在Objc中):

UIAlertController *alert =
  [UIAlertController alertControllerWithTitle:@"Network Unavailable"
                                      message:@"Oh noes!"
                               preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction *cancelAction =
  [UIAlertAction actionWithTitle:@"Ok"   
                           style:UIAlertActionStyleCancel
                         handler:^(UIAlertAction *action) {
                                                        }];
[alert addAction:cancelAction];    
[self presentViewController:alert animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参阅UIAlertController文档.