Xcode 6或iOS 8 Bug:UIAlertController未显示消息?

3
在我的视图控制器中,我有以下代码来创建一个UIAlertController
 var avc = UIAlertController(title: "Location", message: "Please Enter A Location", preferredStyle: UIAlertControllerStyle.Alert)
            self.navigationController!.presentViewController(avc, animated: true, completion: nil)

在模拟器中运行它,我看到

enter image description here

很确定这是Xcode 6 beta 7或Swift中的一个bug?有什么想法吗?

1个回答

4

我找到了答案,我需要给UIAlertController添加一个动作,以便显示消息:

    alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))

6
看起来像是一个bug。我会提交报告。 - Scott Berrevoets

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接