【发布时间】:2016-02-17 07:52:35
【问题描述】:
UiApplication.sharedApplication().scheduleLocalNotifications(notification) 行给了我以下错误value of type 'uiapplication' has no member ' 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.
}
【问题讨论】:
-
不要使用打印来显示您的代码,而是插入文本。
-
请分享
localNotification变量的完整声明
标签: ios xcode swift notifications