2014-08-29 94 views
0

我刚刚将部署目标从iOS 8更改为7,因此我第一次在iOS 7上测试了我的应用程序。显示UIAlertController时应用程序崩溃

我在调用UIAlertController时遇到了崩溃我的应用程序的问题。它适用于iOS 8精绝然不工作在iOS 7

在这里,在所有是我使用的代码:

@IBAction func resetAllButton(sender : AnyObject) { 
    var alert = UIAlertController(title: "Start Over", message: "Are you sure you want to start over? This will erase your budget and all transactions.", preferredStyle: UIAlertControllerStyle.Alert) 
    alert.addAction(UIAlertAction(title: "I'm sure!", style: UIAlertActionStyle.Default, handler:{ (ACTION :UIAlertAction!)in 
     self.resetView() 
     })) 
    alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil)) 

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

回答

2

UIAlertController仅在iOS 8或更高版本中提供。您需要使用UIAlertView才能在iOS 7上显示警报。