Reputation: 408
How can open my app to a particular page from Intents ?
Adding : AppDelegate method not getting called :
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
Following code I have used in handle:
let bundle = Bundle(for: SendPaymentIntentHandler.self)
let bundleIdentifier = bundle.object(forInfoDictionaryKey: "CFBundleIdentifier") as? String ?? "com.XXX.XXXX"
print("BundleIdentifier \(bundleIdentifier)")
let userActivity = NSUserActivity(activityType: String(describing: INSendMessageIntent.self))
userActivity.userInfo = [NSString(string: "success"):NSString(string: "openTPage")]
let response = INSendPaymentIntentResponse(code: .success, userActivity: userActivity)
let paymentRecord = INPaymentRecord(payee: payee, payer: nil, currencyAmount: currencyAmount, paymentMethod: nil, note: intent.note, status: .pending)
response.paymentRecord = paymentRecord
completion(response)
But I get this following status over console, and my app doesn't open:
Upvotes: 3
Views: 805
Reputation: 408
OKAY. SHARING IT HERE FOR A QUICK REFERRENCE
After banging my head for 2-3 days I have this conclusion, let me know if anyone knows otherwise.
Firstly: Vocabulary is only available for shortcuts and not directly talking to Siri through Intents.
Link: Customized intent does not work with SiriKit
Custom intents are currently for the creation of Siri Shortcuts, and not for ad hoc spoken queries. You can only speak to Siri about your app via the documented SiriKit domains. I hope that more interactivity via custom intents is part of the Siri technology roadmap, but it isn't in iOS 12.
Secondly: We don't have much options to open our app or to Deeplink through Siri.
The options are only continueInApp
and failureRequiringAppLaunch
through response code in the certain Intents response codes(ex: INStartWorkoutIntentResponse) and not all(ex: INSendPaymentIntentResponse)
Intents may launch your app under the following circumstances: Some intents always launch the app after the intent is successfully handled (for example, intents with a continueInApp response code). Your intent's handle and confirm methods launch the app when you resolve the intent with a failureRequiringAppLaunch (or similar) response code. The user can always decide to launch the app at any point in a Siri transaction.
Please update if anyone has otherwise information with links.
Thanks
Upvotes: 2