INSendPaymentIntent 处理完成后打开应用程序 - SiriKit Intents

INSendPaymentIntent after handle Completion Open app - SiriKit Intents

如何从 Intents 打开我的应用到特定页面?

添加:未调用 AppDelegate 方法:

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {

我在句柄中使用了以下代码:

 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)

但是我通过控制台得到以下状态,我的应用程序没有打开:

好的。在此分享以供快速参考

我磕了2-3天的脑袋,得出这个结论,有知道的请告诉我。

首先:词汇仅可用于快捷方式,不能通过 Intents 直接与 Siri 对话。

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.

其次:我们没有太多选项可以打开我们的应用程序或通过 Siri 进行深度链接。 选项只有 continueInAppfailureRequiringAppLaunch 通过某些 Intents 响应代码中的响应代码(例如:INStartWorkoutIntentResponse)而不是全部(例如: INSendPaymentIntentResponse)

Link: https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623072-application?language=objc

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.

如果有人有其他信息和链接,请更新。

谢谢