0

我创建了一个 iOS 应用扩展,并在扩展的 plist IntentsSupported 数组中定义了一个条目 INPlayMediaIntent。一切都很好。但是几天后(WWDC 2019)我无法将应用程序提交到 TestFlight/App Store Connect。

我按照 Apple 的说明修复了这些错误:

现在我试图在 AppIntentVocabulary.plist 中提供一个意图参数:

<dict>
    <key>ParameterVocabularies</key>
    <array>
        <dict>
            <key>ParameterNames</key>
            <array>
                <string>INPlayMediaIntent.mediaItems</string>
            </array>

根据这些 App Store 电子邮件,我尝试了各种字符串,但都错了:

  • ITMS-90626:无效的 Siri 支持 - “INPlayMediaIntent.mediaItems”不是订阅意图的受支持的意图参数

  • ITMS-90626:无效的 Siri 支持 - “INPlayMediaIntent.mediaContainer”不是订阅意图的受支持的意图参数

  • ITMS-90626:无效的 Siri 支持 - “INPlayMediaIntent.identifier”不是订阅意图的受支持的意图参数

INPlayMediaIntent的有效参数名称是什么

这可能很容易,因为 Apple 在这里有一个 INPlayMediaIntent 示例项目,我曾经为我的项目学习过:

https://developer.apple.com/documentation/sirikit/media/playing_media_through_siri_shortcuts

但是:这个项目似乎不是最新的,因为它缺少最近似乎需要的 AppIntentVocabulary.plist。

4

2 回答 2

1

我想回答实际问题,因为文档在这方面非常具有误导性。如果它是正确的,那么只允许“来自意图类的属性名称的键路径 [s]”,这对INPlayMediaIntents 没有任何意义。为了找到正确的答案,我观看了设计高质量 Siri 媒体交互,在 12:20 我们可以看到一张幻灯片,其中包含从用户词汇符号(强输入)到要在AppIntentVocabulary.plist中使用的字符串的映射。

检查是否支持键的一般想法是转到INVocabularyStringType并检查以相应 Siri 域开头的那些(在本例中media<SomeThing>),然后INPlayMediaIntent.someThing用于 plist 中的ParameterNames数组。

使用 SiriKit示例代码管理音频中,我们可以看到一个使用INPlayMediaIntent.playlistTitle.

于 2022-01-18T11:10:34.520 回答
0

我联系了 Apple 的开发人员支持并得到了这个答案:

“您应该能够在没有看到这些警告的情况下将您的应用程序提交到 AppstoreConnect。请提交有关此问题的完整错误报告……”

我恢复了试图修复初始错误消息的更改,并且我当前的构建不再收到警告。

处理意图以这种方式工作:

- (void)application:(UIApplication *)application handleIntent:(INIntent *)intent completionHandler:(void (^)(INIntentResponse * _Nonnull))completionHandler {
        INPlayMediaIntent *mediaIntent = (INPlayMediaIntent *)intent;
        INMediaItem *mediaItem = [mediaIntent.mediaItems firstObject];
        NSString *myId = mediaItem.identifier;
        INMediaItemType mediaType = mediaItem.type;
// play some media identified by myId and mediaType
        INPlayMediaIntentResponse *response = [[INPlayMediaIntentResponse alloc] initWithCode:INPlayMediaIntentResponseCodeSuccess userActivity:nil];
        completionHandler(response);
}
于 2019-06-14T06:54:14.230 回答