ios - 带有振动的 UILocalNotification

标签 ios swift uilocalnotification

有什么方法可以在触发通知的同时添加本地通知的振动效果。

let AlarmNotification: UILocalNotification = UILocalNotification()
    AlarmNotification.alertBody = title
    AlarmNotification.alertAction = "Open App"
    AlarmNotification.category = "AlarmCategory"

    AlarmNotification.soundName = soundName + ".mp3"
    AlarmNotification.timeZone = NSTimeZone.defaultTimeZone()
UIApplication.sharedApplication().scheduleLocalNotification(AlarmNotification)

最佳答案

阅读指南,您只能将声音设置为警报

the system displays the alert message, badges the app, and plays a sound—whatever is specified in the notification.

链接:https://developer.apple.com/library/ios/documentation/iPhone/Reference/UILocalNotification_Class/

关于ios - 带有振动的 UILocalNotification,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36548345/

相关文章:

objective-c - iOS - 需要区分应用程序中的 UILocalNotification :didReceiveLocalNotification:

iphone - 如何暂时禁用 iPhone 应用程序安排的所有本地通知?

ios - 核心数据 NSPersistentStoreCoordinator 从来电调用中止,SWIFT

ios - 将获取数据与 UITableView 不同部分的核心数据分开

ios - 从 AirPod 麦克风录制音频

ios - Swift AnyObject 作为 String 动态转换失败

ios - 在 Swift 中的 Controller 之间传递数据

ios - MonoTouch - 相当于 iOS UI 中的对接和锚定

swift - 在 Swift 中,您能否创建一个仅在特定条件满足相关类型时才需要特定功能的协议(protocol)?

ios - UILocalNotifcation 未在 swift 2.0 中触发