iossirikitsirishortcuts

Siri Support: What are supported intent parameters for INPlayMediaIntent?


I created an iOS App Extension and defined a single entry INPlayMediaIntent in the extension's plist IntentsSupported array. Everything was fine. But since a few days (WWDC 2019) i have trouble submitting the app to TestFlight/App Store Connect.

I followed Apple's instructions and fixed these errors:

Now I'm trying to provide an intent parameter in the AppIntentVocabulary.plist here:

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

I tried it with various strings and all were wrong according to these App Store emails:

What would be a valid parameter name for an INPlayMediaIntent?

It could be so easy because Apple has an example project for INPlayMediaIntent here which i used to learn for my project:

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

But: This project seems not to be up to date since it is missing the AppIntentVocabulary.plist which seems to be required recently.


Solution

  • I contacted Apple's developer support and got this answer:

    "You should be able to submit your app to AppstoreConnect without seeing these warnings. Please submit a complete bug report regarding this issue …"

    I reverted my changes that tried to fix the initial error messages and my current build did not get warnings anymore.

    Handling the intent works this way:

    - (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);
    }