小编Ant*_*ché的帖子

iOS 15 通讯通知图片未显示

我一直在尝试将我的(本地和推送)通知更新为通信通知。

\n

当用户收到来自其朋友之一的通信事件时,我希望显示的通知包含该朋友的个人资料图片。就像新的 iMessage 应用程序一样。

\n

观看专门的 WWDC2021 会议后,我向我的 SwiftUI 应用程序添加了 Siri Intent:

\n
// I correctly added the StartCallIntent to both my app\'s Info.plist and the Siri Intent extension.\n<array>\n    <string>INStartCallIntent</string>\n</array>\n
Run Code Online (Sandbox Code Playgroud)\n

并尝试使用以下内容更新我的通知流程:

\n
// I correctly added the StartCallIntent to both my app\'s Info.plist and the Siri Intent extension.\n<array>\n    <string>INStartCallIntent</string>\n</array>\n
Run Code Online (Sandbox Code Playgroud)\n

然后,返回的信息UNNotificationContent将被处理为显示为推送通知或本地通知。

\n

虽然上面的代码不会崩溃并且似乎/工作/,但通知看起来没有任何不同。\n使用调试器查看,已_UNNotificationCommunicationContext初始化,但是:

\n
    \n
  • _displayName为零
  • \n
  • _recipients为空(如预期)
  • \n
  • _contentURL为零
  • \n
  • _attachments是空的
  • \n
  • sender被设置为UNNotificationContact一个\n
      \n
    • handle& …

apple-push-notifications wwdc uilocalnotification swift ios15

11
推荐指数
1
解决办法
5591
查看次数