swift - 使用 registerForLocalNotifications 时 Unresolved external 问题

标签 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

}

它返回使用未解析的标识符“registerForLocalNotifications”

有什么想法吗?

最佳答案

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

我认为你需要...

import ExternalAccessory

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

EAAccessoryManager.sharedAccessoryManager().registerForLocalNotifications()

关于swift - 使用 registerForLocalNotifications 时 Unresolved external 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36611417/

相关文章:

linux - 如何识别设备(Linux,Unix)

ios - Xcode 使用未声明的标识符

iOS - 在父级插入 AnotherVC 后如何在 NavigationController 堆栈中找到 ChildVC

java - 检测、通知和同步的含义

java - 任何生成类似于 YouTube 视频字符串的标识字符串的 Java 方法?

ios - 禁用通知时,未在前台调用 didreceiveremotenotification

c++ - 在操作中心处理多个 toast 通知?

ios - 只使用一个 AVAudioPlayer 而不是三个

xcode - 使用 Swift 通过 iPhone 扬声器强制播放音频文件

ios - UIPickerView 在错误的组件中选择行(需要驱魔?)