问题
*Using Swift 4.2 & Xcode 10.2
I'm trying to make my application more feature-rich by allowing a user to create an object hands free. The app is designed to make the creation of certain object easier, so it would be great to allow a user to create a basic object by invoking Siri. However, I'd like the Siri functionality to be already integrated when the app is downloaded/run for the first time.
The issues I'm having with SiriKit and Shortcuts right now:
You are recommended to "donate" a custom intent whenever correlating functionality is triggered in your mobile app so that Siri can recommend other times to suggest using the shortcut - I would like this to just be standard functionality that I don't need to "donate". I'm dealing with an older targeted user base, and prompting the end user to go into their settings to add the shortcut to Siri and do the additional setup will get lost on a lot of users.
For example:
My application is used for creating and posting simple Plane objects with properties of name & color.
I'd like to allow users to initialize Siri hands-free and create this object like so:
"Hey Siri, create a plane with name Warkhawk and color blue"
The web is saturated with information on these new shortcuts, but I don't like that you have to "donate" the intent when you trigger the functionality in your app, and then go to settings to actually add it to Siri.
How can I utilize Siri to fit this use case without all of the added steps that come with a shortcut?
Thank you!
回答1:
Unfortunately at this time you cannot do what you want without user interaction.
An app can expose Siri Intents in one of the supported intent domains, such as making a VoIP call or making a payment. I don't believe that any of those domains would be suitable for your task.
In iOS 12 an app can donate Siri Shortcuts, as you mentioned. These have a more flexible format in terms of triggering vocabulary but must be set up by the user.
回答2:
For a faster and easier way to donate Siri INIntent
you can use
INUIAddVoiceShortcutViewController
Works like a UIImagePickerController, it’s a “shortcut" that will bring user directly to the phrase voice record screen. No need to leave your app making it much easier to use.
Example guide
来源:https://stackoverflow.com/questions/56029795/how-can-i-utilize-siri-to-create-a-custom-object-without-donating-intents-or-usi