使用registerForLocalNotifications时未解析的外部

时间:2016-04-13 23:43:33

标签: swift notifications identifier

我正在尝试为我的swift应用设置通知,当我输入时:

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

}

返回Use of unresolved identifier 'registerForLocalNotifications'

任何想法?

1 个答案:

答案 0 :(得分:0)

您正在调用属于ExternalAccessory框架的函数,就好像它是您自己的类的函数一样。

我认为你需要......

import ExternalAccessory

...在您的导入中,然后再...

EAAccessoryManager.sharedAccessoryManager().registerForLocalNotifications()