2
A
回答
1
試着改變你通知服務擴展代碼:
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
if let bestAttemptContent = bestAttemptContent {
// Modify the notification content here
// Convert received string
let data = bestAttemptContent.body.data(using: .utf8)!
// Apply encoded string
bestAttemptContent.body = String(data: data, encoding: .utf16)
contentHandler(bestAttemptContent)
}
}
+0
我試圖做bestAttemptContent.title =「我真棒」,但標題顯然是儘管@仍然是我的「警戒」。@ – Happiehappie
+0
我做了一些挖掘和測試,顯然要改變的屬性是身體而不是標題?只是想澄清你。 – Happiehappie
+0
@Happiehappie當然,如果'身體'工程然後使用它。我只是把'title'作爲例子,因爲它取決於你的PN實現。 – njuri
相關問題
- 1. iOS推送通知消息
- 2. 推送通知標誌清除警報
- 3. 推送通知警報處理
- 4. 推送通知警報中的表情
- 5. 推送通知警報視圖操作?
- 6. 用於HTML的通知警報消息
- 7. 蘋果推送通知服務 - 更改通知消息的標題
- 8. quickblox ios推送通知消息問題
- 9. 不要推送通知消息
- 10. 消息不刷新推送通知
- 11. Pushpad或Web推送通知消息
- 12. iPhone推送通知(非英文消息)
- 13. 推送通知消息定製?
- 14. iOS推送通知 - 無警報更新徽章?
- 15. 取消Android報警/通知
- 16. 推送通知警告?
- 17. 當警報狀態更改爲OK時發送SNS通知
- 18. 警報消息
- 19. 警報消息
- 20. Firebase推送通知的通知消息的click_action不起作用
- 21. 通過推送通知發送圖像或消息
- 22. 如何更改推送通知聲音?
- 23. 更改推送通知聲音
- 24. 更改推送通知的數據
- 25. 如何更改iOS中推送通知消息按鈕的文本?
- 26. 報警通知
- 27. 當推送通知進入時的警報序列
- 28. 推送通知警報文本的最大長度是多少?
- 29. Xcode UITest推送通知警報無法點擊「允許」
- 30. 從推送通知的警報視圖啓動應用程序
好問題,我從來沒有遇到過這樣的問題......(Y) –