ios - 如何在 iOS 上使用 Firebase 取消 Nest ETA?

标签 ios firebase nest-api

根据 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_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 年的某个时候!

我在这里做错了什么?!

谢谢!

最佳答案

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

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

相关文章:

firebase - 当我连接到 firebase 时,我只看到结构而没有设备(Nest API)

nest-api - Nest API iOS 错误

ios - 在 Xcode 8 (Swift 3) 中手动导入 Firebase Framework

android - Firebase 通知不显示使用 PHP

ios - 如果应用程序已经在后台运行,如何响应推送通知 View

javascript - iPhone 上的 Knockout.js 问题 - 下拉列表问题

swift - 导航栏隐藏在 JSQMessagesViewController 中

javascript - 使用 cylon.js 的 Nest 恒温器

ios - FMResultSet 中的内存泄漏 - FMDB

ios - View 中添加的事件按钮不起作用,iOS