Can my application detect that it was opened by Siri?

Can my Swift application detect that it was open Siri? I would like to open a specific viewControllerif (and only if) my application was opened by Siri.

+4
source share
3 answers

This, unfortunately, is not yet possible. You can read SiriKit what you can do, not. This is the first version of SiriKit, it will probably come later.

0
source

watchOS3.2. ExtensionDelegate, handle (userActivity). Siri, userActivity.activityType INIntentResponse, IntentHandler, , userActivity.activityType INIntentResponse, Intents.

0

Including this in didFinishLaunchingWithOptions worked for me the first time I started.

ObjC:

BOOL startedFromSiri = ([[launchOptions objectForKey:UIApplicationLaunchOptionsSourceApplicationKey] isEqualToString:@"com.apple.assistant.assistantd"]) ? YES : NO;

Swift:

let startedFromSiri: Bool = (launchOptions[.sourceApplication] == "com.apple.assistant.assistantd") ? true : false

-1
source

Source: https://habr.com/ru/post/1657338/


All Articles