第UiApplication.sharedApplication().scheduleLocalNotifications(notification)
行给出了以下错误value of type 'uiapplication' has no member ' schedulelocalnotification'
我该如何解决这个问题?
import UIKit
class SchermataIniziale:UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let notification = UILocalNotification()
if #available(iOS 8.2, *) {
notification.alertTitle = "Mille Favole"
} else {
// Fallback on earlier versions
}
notification.alertBody = "Ricordati di leggere la favola questa sera"
notification.fireDate = NSDate(timeIntervalSinceNow: 10)
notification.applicationIconBadgeNumber = 1
notification.timeZone = NSTimeZone.defaultTimeZone()
notification.soundName = UILocalNotificationDefaultSoundName
UIApplication.sharedApplication().scheduleLocalNotifications(notification)
//showinitial = false
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
答案 0 :(得分:2)
您需要致电scheduleLocalNotification
而不是scheduledLocalNotification
示例:
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
见这里:use