iosxcodefirebasenest-api

Unable to read/write values to Nest Firebase with newest Firebase Framework


I have been trying to integrate nest into my iOS application, following all the instructions regarding user authentication and then making calls to the nest API. I used Nest's iOS example app as a reference:

https://github.com/nestlabs/iOS-NestDK

I confirmed that their project is working. Here is some code that comes from their project which I modified to look and see if anything was set for "data".

    self.rootFirebase = [[Firebase alloc] initWithUrl:@"https://developer-api.nest.com/"];
    [self.rootFirebase authWithCredential:[[NestAuthManager sharedManager] accessToken] withCompletionBlock:^(NSError *error, id data)
     {
         if (error)
         {
             NSLog(@"Auth Failed! %@", error);
         }
         else
         {
             NSLog(@"Auth succeeded! %@", data);

     } withCancelBlock:^(NSError *error) {}];

Using the same exact function authWithCredential in my code with the newest Firebase framework, no errors appear and I get a response with data. However, making calls in my code such as:

Firebase *newFirebase = [self.rootFirebase childByAppendingPath:@"devices"];

             [newFirebase observeEventType:FEventTypeChildAdded withBlock:^(FDataSnapshot *snapshot)
              {
                  NSLog(@"Got devices: %@", snapshot.value);
              }];

Nothing is returned. I have confirmed that there are a few devices set up, as they are showing up in the app they provided. I have logged in and authorized with the same Nest account on both their app and mine.

I figured they were using an old Firebase framework, so I removed that framework from their project and added in the new one. Same result - Now their project app no longer returns any structures/devices/thermostats. I noticed that authWithCredential is now deprecated...so I attempted to use authWithCustomToken in both their app and in my app to see if it would be any different, but still, nothing is returned when I try to grab information from Nest, even though it seems to be successfully authorizing...

I use my own Firebase for other features in my app which depends on using the newest framework, so I wouldn't want to use an older version.

Has anyone else ran into this issue? Any thoughts/solutions?

Any help would be much appreciated.


Solution

  • Yes, I have the same issue when upgrading from SDK version 1.2.1 to 2.0.1. Authentication seems to succeed, but there's no other data coming back from the server.

    Reverting to 1.2.1 would likely solve my issue (a beta of my app which was compiled with 1.2.1 still works fine), but I unfortunately lost the framework file I used earlier and FireBase doesn't appear to have a public archive of older versions of their frameworks.

    I'm now forced to use 1.1.8 (used in Nest's sample app), changing authWithCustomToken to authWithCredential, as the latter was introduced in 1.2 apparently.

    In your case, you'll have to wait for either Firebase of Nest to fix the issue that prevents 2.0.x from working with the Nest API.