如果我发帖不正确,我深表歉意,因为我对在这里发帖有点陌生。我目前正在尝试将 siri 快捷方式添加到我的应用程序中。我已经创建了意图,并且能够正确处理它并使用虚拟数据创建响应。
但是,尽管将我的应用程序添加到意图处理程序类的目标中,但我无法从应用程序访问我的服务类和其他对象。
class IntentHandler: INExtension, TestIntentHandling {
@available(iOS 12.0, *)
func confirm(intent: TestIntent, completion: @escaping (TestIntentResponse) -> Void) {
print("HERE")
completion(TestIntentResponse.init(code: .ready, userActivity: nil))
}
@available(iOS 12.0, *)
func handle(intent: TestIntent, completion: @escaping (TestIntentResponse) -> Void) {
let response = TestIntentResponse.init(code: .success, userActivity: nil)
//Trying to reach into service here to get real values
response.workout = "Bench Press"
response.weight = 150
completion(response)
}
}
我想进入我的应用程序服务以在我的句柄函数中填充我的锻炼和体重字段,但我不断收到错误消息,说我的服务类不存在,并希望有人能够指出我正确的方向。谢谢!