嗨,如果你想存储数据在本地推送通知,那么你可以添加这样的数据试试看。
let interval = TimeInterval(1)
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: interval, repeats: false)
let content = UNMutableNotificationContent()
content.title = "Incoming video call from - Bob"
content.body = "Your body"
content.sound = UNNotificationSound.init(named: "CustomSound.mp3")
content.badge = "Your badge number"
content.userInfo = ["userData": YOUR_USER_DATA from remote]
let req = UNNotificationRequest(identifier: "localPushNotification", content: content, trigger: trigger)
let center = UNUserNotificationCenter.current()
center.add(req, withCompletionHandler: nil)
感谢您的回答,我使用apple Voip推送服务和Pushkit Framework实现了它,它允许我在本地通知中处理我的有效内容,而应用程序处于后台或强行终止状态。 –