You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已捐赠的INSendMessageIntent未在iPhone的Share Extension分享建议中显示

问题:Share Extension消息对话分享建议在iPhone上不显示,iPad正常

我正尝试为通用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配置截图

主App info.plist配置截图

Share Extension 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 22:22:34