OGeek|极客世界-中国程序员成长平台

标题: ios - 如何在 iOS 上使用 Firebase 取消 Nest ETA? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 17:24
标题: ios - 如何在 iOS 上使用 Firebase 取消 Nest ETA?

根据 Nest API 文档:

“要取消 eta,请发送estimated_arrival_window_begin = 0。请检查您在此调用中发送的是整数(0),而不是字符串(“0”),否则调用将失败。”

https://developers.nest.com/documentation/cloud/eta-reference/

我的代码基于使用 Firebase 的 iOS NestDK 示例。

我使用 addSubscriptionToURL 方法进行如下设置:​

[[FirebaseManager sharedManager] addSubscriptionToURL:[NSString stringWithFormat"structures/%@/eta", structureId] withBlock:^(FDataSnapshot *snapshot) {}];

然后我可以成功调用为特定行程设置 eta 窗口。

但是,我似乎无法取消同一行程的 eta。如果我只指定 trip_idestimated_arrival_window_begin 属性,我会收到一条错误消息,提示 estimated_arrival_window_end 字段丢失。

NSMutableDictionary *values = [[NSMutableDictionary alloc] init];
[values setValue:[_tripId UUIDString] forKey"trip_id"];
[values setValue:[NSNumber numberWithInt:0] forKey"estimated_arrival_window_begin"];
[[FirebaseManager sharedManager] setValues:values forURL:[NSString stringWithFormat"structures/%@/eta", structureId]];

我也尝试将 estimated_arrival_window_end 设置为 0,但随后我收到一条错误消息,指出 estimated_arrival_window_begin 已过去。它似乎将 0 值解释为时间的开始。无论如何,在 1970 年的某个时候!

我在这里做错了什么?!

谢谢!



Best Answer-推荐答案


您是否将 Nest 帐户用于通过 Nest Home Simulator 创建的虚拟设备?使用虚拟设备与使用真实设备似乎存在错误。请尝试在真实设备上使用 Nest 帐户。

关于ios - 如何在 iOS 上使用 Firebase 取消 Nest ETA?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39222958/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4