根据 nest API 文档:
“要取消预计到达时间,请发送 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) {}];
然后我可以成功调用以设置特定行程的预计到达时间。
但是,我似乎无法取消同一行程的预计到达时间。如果我只指定 trip_id
和 estimated_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 年的某个时候!
我在这里做错了什么?!
谢谢!
最佳答案
您是否将 Nest 帐户与通过 Nest Home Simulator 创建的虚拟设备一起使用?使用虚拟设备与真实设备相比似乎存在错误。请尝试在真实设备上使用 Nest 帐户。
关于ios - 如何在 iOS 上使用 Firebase 取消 Nest ETA?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39222958/