0

我正在尝试使用 sirikit 退回我存储在 firebase 上的账单。它不会退回它找到的账单。这是我的句柄功能。我正在使用 getBills 函数从数据库中获取我的账单:

func handle(searchForBills intent: INSearchForBillsIntent, completion: @escaping (INSearchForBillsIntentResponse) -> Void) {
         var arrayOfBills: [INBillDetails] = []
         APIManager.getBills { (success, bills) in
            if(success) {
            for bill in bills {
                 if (bill.type == intent.billType.rawValue) {
                    var nickname: INSpeakableString = INSpeakableString(identifier: bill.billPayeeNickName, spokenPhrase: bill.billPayeeNickName, pronunciationHint: bill.billPayeeNickName)
                    var organizationalName: INSpeakableString = INSpeakableString(identifier: bill.billPayeeOrganzationalName, spokenPhrase: bill.billPayeeOrganzationalName, pronunciationHint: bill.billPayeeOrganzationalName)

                    var billPayee: INBillPayee = INBillPayee(nickname:  nickname, number: bill.billPayeeAccountNumber, organizationName: organizationalName)!
                    var nsDecimalTotal: NSDecimalNumber = NSDecimalNumber(string: bill.total)
                    var amountDueInCurrency: INCurrencyAmount = INCurrencyAmount(amount: nsDecimalTotal, currencyCode: "$")

                    var dateC: DateComponents = DateComponents(calendar: Calendar.current , timeZone: TimeZone.current, era: 1, year: 2017, month: 5, day: 23, hour: 2, minute: 2, second: 2, nanosecond: 2, weekday: 3, weekdayOrdinal: 3, quarter: 3, weekOfMonth: 23, weekOfYear: 33, yearForWeekOfYear: 44)

                    var billToReturn = INBillDetails(billType: INBillType(rawValue: bill.type)!, paymentStatus: INPaymentStatus(rawValue: bill.status)!, billPayee: billPayee, amountDue: amountDueInCurrency, minimumDue: amountDueInCurrency, lateFee: amountDueInCurrency, dueDate: dateC, paymentDate: dateC)
                    arrayOfBills.append(billToReturn!)
                 }
            }
                print("success")
                var response = INSearchForBillsIntentResponse(code: .failure, userActivity: nil)
                //response.bills = arrayOfBills
                completion(response)
             }
            else {
                print("failed")
                completion(INSearchForBillsIntentResponse(code: .failure, userActivity: nil))
            }
    }
4

1 回答 1

0

您的 INSearchForBillsIntentResponse 在两种情况下均以“失败”启动。您没有成功代码 - 这可能会导致 Siri 不退回账单。您还需要取消对响应的账单分配的注释。

起初我在 Bills 功能上也遇到了一些问题,但看起来大多数错误都已在 iOS 10.3 beta 4 中修复(尽管 SearchForBills UI 不是那么好)。

于 2017-03-04T14:34:33.370 回答