我正在尝试将 Siri Shortcuts 集成到我的应用程序中。我正在尝试的概念是通过秘密密码确认获得我的卡的奖励积分。请在下面找到我为此所做的工作。
添加了名为 say Rewards 的新自定义意图。
定义了标题。启用确认的字幕和参数(accType,pin)。Pin 将单独发送给用户。
//
// RewardsIntentHandler.swift
// SiriIntentExt
//
import UIKit
import Intents
class RewardsIntentHandler: NSObject, RewardsIntentHandling {
func resolveAccType(for intent:RewardsIntent, with completion: @escaping ([INStringResolutionResult]) -> Void) {
guard let accType = intent.accType else {
completion([INStringResolutionResult.needsValue()])
return
}
completion([INStringResolutionResult.success(with: accType)])
}
func resolvePin(for intent:RewardsIntent, with completion: @escaping ([INIntegerResolutionResult]) -> Void) {
guard let verifyPin = intent.pin else {
completion([INIntegerResolutionResult.needsValue()]) …
Run Code Online (Sandbox Code Playgroud)