句柄完成打开应用程序后的INSendPaymentIntent-SiriKit Intents

时间:2018-12-14 11:34:26

标签: ios swift sirikit

如何从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)

但是我通过控制台获得以下状态,并且我的应用无法打开:

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:2)

好的。在这里共享以快速引用

敲了2-3天后,我得出了这个结论,请告知是否有人不知道。

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

链接:Customized intent does not work with SiriKit

  

自定义意图目前仅用于创建Siri快捷方式,不适用于临时口头查询。您只能通过已记录的SiriKit域与Siri谈谈您的应用。我希望通过自定义意图进行更多的交互是Siri技术路线图的一部分,但不是在iOS 12中。

第二:我们没有太多选择来打开我们的应用程序或通过Siri进行Deeplink。 通过某些Intent响应代码(例如: INStartWorkoutIntentResponse )中的响应代码,这些选项仅是continueInAppfailureRequiringAppLaunch而并非全部(例如: INSendPaymentIntentResponse ) )

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

  

在以下情况下,Intent可能会启动您的应用程序:   某些意图总是在成功处理意图之后启动应用程序(例如,具有continueInApp响应代码的意图)。   当您使用failureRequiringAppLaunch(或类似的响应)代码解析意图时,意图的句柄和确认方法将启动应用程序。   用户始终可以决定在Siri交易中的任何时候启动该应用程序。

如果有人知道链接的其他信息,请更新。

谢谢