小编hoo*_*ood的帖子

在带有消息的远程通知中显示超链接

我需要在远程通知中显示超链接以及标题和正文。我做过这样的事情:

@IBAction func openPDFButtonPressed(_ sender: Any) {
    self.scheduleNotification()         
}

func scheduleNotification() {
    let center = UNUserNotificationCenter.current()

    let content = UNMutableNotificationContent()
    content.title = "Download The Receipt"
    content.body = "Kindly Download your purchase bill"
    content.categoryIdentifier = "PDF"
    content.userInfo = ["customData": "http://www.pdf995.com/samples/pdf.pdf"]
    content.sound = UNNotificationSound.default

    var dateComponents = DateComponents()
    dateComponents.hour = 10
    dateComponents.minute = 30
    let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)

    let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
    center.add(request)
}  

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c ios rich-notifications swift

7
推荐指数
1
解决办法
232
查看次数

标签 统计

ios ×1

objective-c ×1

rich-notifications ×1

swift ×1

xcode ×1