Swift通知不起作用

时间:2016-04-19 01:13:55

标签: swift notifications

我正在尝试为简单的swift应用设置预定的本地通知。到目前为止我的代码是:

@UIApplicationMain

    class AppDelegate: UIResponder, UIApplicationDelegate {


        var window: UIWindow?
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        //Tell app to ask for user permission
            EAAccessoryManager.sharedAccessoryManager().registerForLocalNotifications()
        return true

        }

        func application(application: UIApplication, performFetchWithCompletionHandler completionHandler:

            (UIBackgroundFetchResult) -> Void) {
            scheduleLocalNotifications()
            completionHandler(UIBackgroundFetchResult.NoData)
        }

但是当我将s cheduleLocalNotifications()添加到我的代码中时,

错误行说:

Use of unresolved identifier 'scheduleLocalNotifications'

1 个答案:

答案 0 :(得分:0)

我可能会离开但是试试

UIApplication.sharedApplication().scheduledLocalNotifications