已捐赠的INSendMessageIntent未在iPhone的Share Extension分享建议中显示
我正尝试为通用App的Share Extension添加消息对话分享建议支持,该建议在iPad上可正常显示,但在我的iPhone及其他测试iPhone上均不出现。我已按照Apple官方文档完成以下配置:
- 主App的info.plist中已添加正确的NSUserActivityTypes:
INSendMessageIntent - Share Extension的info.plist中已配置IntentsSupported:
INSendMessageIntent - 捐赠Intent的代码运行正常,完成回调未返回任何错误
即使使用最新版本Xcode(Version 15.3 (15E204a))创建新项目,仍存在相同问题。
主App info.plist配置截图

Share Extension info.plist配置截图

捐赠Intent代码
private func donateIntent(chatName: String, chatID: String, groupImage: INImage?) { let groupName = INSpeakableString(spokenPhrase: chatName) let intent = INSendMessageIntent( recipients: nil, outgoingMessageType: .outgoingMessageText, content: nil, speakableGroupName: groupName, conversationIdentifier: chatID, serviceName: nil, sender: nil, attachments: nil) if let groupImage = groupImage { intent.setImage(groupImage, forParameterNamed: \.speakableGroupName) } let interaction = INInteraction(intent: intent, response: nil) interaction.donate { error in if let error = error { print("Error donating intent: \(error)") } else { print("Successfully donated sendMessage intent.") } } }
内容的提问来源于stack exchange,提问作者Kris Gellci
相关产品推荐
相关产品推荐

