行UiApplication.sharedApplication().scheduleLocalNotifications(notification)
给我以下错误类型'uiapplication'的值没有成员'schedulelocalnotification'
我该如何解决这个问题?
import UIKit
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.
}
最佳答案
您需要调用scheduleLocalNotification
而不是scheduledLocalNotification
示例:
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
关于ios - Swift 中的本地通知 ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35444393/