gpt4 book ai didi

ios - 支持共享表建议

转载 作者:行者123 更新时间:2023-12-01 19:32:52 33 4
gpt4 key购买 nike

关注此 article我正在尝试在我的消息传递应用程序中实现共享表建议。

我已声明 INSendMessageIntent支持我的分享扩展 info.plist .

info.plist

它甚至出现在 下的目标中'支持的意图' .

target

但每次我捐赠一个 INSendMessageIntent它没有说 INSendMessageIntent不支持。

Error Domain=IntentsErrorDomain Code=1901 "Donating intent 'INSendMessageIntent' is not supported by this extension. Please make sure that you declare the intents that your app supports by including the NSUserActivityTypes key in its Info.plist or your app contains an Intents extension that supports this intent."


// Create an INSendMessageIntent to donate an intent for a conversation with Juan Chavez.
let groupName = INSpeakableString(spokenPhrase: "Juan Chavez")
let sendMessageIntent = INSendMessageIntent(recipients: nil,
content: nil,
speakableGroupName: groupName,
conversationIdentifier: "sampleConversationIdentifier",
serviceName: nil,
sender: nil)

// Add the user's avatar to the intent.
let image = INImage(named: "Juan Chavez")
sendMessageIntent.setImage(image, forParameterNamed: \.speakableGroupName)

// Donate the intent.
let interaction = INInteraction(intent: sendMessageIntent, response: nil)
interaction.donate(completion: { error in
if error != nil {
// Add error handling here.
} else {
// Do something, e.g. send the content to a contact.
}
})

最佳答案

您应该将 NSUserActivityTypes 条目添加到您的应用程序的 Info.plist。将其声明为数组并将您的意图添加到其中。

How it looks like

关于ios - 支持共享表建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61324938/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com