Ios Swift-UIAlertController没有显示任何内容

Ios Swift-UIAlertController没有显示任何内容,ios,swift,Ios,Swift,我做错了什么?我已经在iOS 8.1模拟器和iOS 8.1的iPodtocuh 5G上测试过了 var alert = UIAlertController(title: "Also save this picture?", message: "Adding this picture to your Camera Roll might be a good idea.", preferredStyle: UIAlertControllerStyle.Alert) alert.

我做错了什么?我已经在iOS 8.1模拟器和iOS 8.1的iPodtocuh 5G上测试过了

var alert = UIAlertController(title: "Also save this picture?", message: "Adding this picture to your Camera Roll might be a good idea.", preferredStyle: UIAlertControllerStyle.Alert)
            alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.Default, handler: { (action: UIAlertAction!) in
                     UIImageWriteToSavedPhotosAlbum(takenImage, nil, nil, nil)
                }))
            alert.addAction(UIAlertAction(title: "No", style: UIAlertActionStyle.Cancel, handler: nil))
            self.presentViewController(alert, animated: true, completion: nil)

值得一提的是,除非我将视图嵌入到导航控制器中,否则无法显示UIAlertController(因此使用Xcode 6的默认“单一视图”模板可以像这样为您设置它).

您在控制台中找到什么了吗?是否向您的项目中添加了导航控制器?我已在示例项目中添加了您的代码,并将viewcontroller嵌入到故事板中的导航控制器中警报显示在上面您将此代码放在何处?你确定它正在运行吗?我怀疑这与
UINavigationController
有什么关系。我间歇性地遇到同样的问题,但在退出Xcode和模拟器时,问题就消失了。还有人看到了吗?该代码是实际的苹果示例代码,因此不太可能是编码错误。