setValue withCompletionBlock not called

307 views
Skip to first unread message

Philippe Fuentes

unread,
Oct 6, 2016, 12:29:26 PM10/6/16
to Firebase Google Group
Hello everybody,

I've been running into some completionBlocks not being called on iOS (simulator and device) when setting values, for example:

- (void)addShortUserPlaylistUrl:(NSString *)playlistId
                   playlistName
:(NSString *)playlistName
                userDisplayName
:(NSString *)userDisplayName
                completionBlock
:(ObjectBlock)completionBlock

{

   
FIRDatabaseReference *newUserPlaylistUrlRef = [[_root child:KPLRUserPlaylistUrlRef] childByAutoId];

   
if (newUserPlaylistUrlRef != nil) {

       
NSString *key = [newUserPlaylistUrlRef key];
       
NSDictionary *dict = @{ @"playlistId" : playlistId,
                               
@"playlistName" : playlistName,
                               
@"userDisplayName" : userDisplayName
                               
};

       
[newUserPlaylistUrlRef setValue:dict withCompletionBlock:^(NSError * _Nullable error, FIRDatabaseReference * _Nonnull ref) {

           
//completion block not called, this code is never reached...
            completionBlock
(key, error);  

       
}];
   
}

}



Here is a paste of the firebase logging, can anyone tell me what's wrong with this code ?




2016-10-06 17:13:33.219 Metalplay PREPROD[25380:1142968] [FirebaseDatabase] Setting: /plr-playlist-url/plr-user-playlist-url/-KTPlM0VHIJmy7IpSbXp with {

    playlistId = "-KTK7289xor0Fba6Y3SW";

    playlistName = TITO;

    userDisplayName = eussam3;

} pri: <null>

2016-10-06 17:13:33.220 Metalplay PREPROD[25380:1142968] [FirebaseDatabase] Was connected, and added as index: 1

2016-10-06 17:13:33.220 Metalplay PREPROD[25380:1142968] [FirebaseDatabase] Sending: {

    d =     {

        a = p;

        b =         {

            d =             {

                playlistId = "-KTK7289xor0Fba6Y3SW";

                playlistName = TITO;

                userDisplayName = eussam3;

            };

            p = "/plr-playlist-url/plr-user-playlist-url/-KTPlM0VHIJmy7IpSbXp";

        };

        r = 12;

    };

    t = d;

}

2016-10-06 17:13:33.221 Metalplay PREPROD[25380:1142968] [FirebaseDatabase] (wsc:2) resetting keepalive, to 2016-10-06 16:14:18 +0000 ; old: 2016-10-06 16:14:08 +0000

2016-10-06 17:13:33.353 Metalplay PREPROD[25380:1142968] [FirebaseDatabase] (wsc:2) handleNewFrameCount: 1

2016-10-06 17:13:33.353 Metalplay PREPROD[25380:1142968] [FirebaseDatabase] (wsc:2) handleIncomingFrame sending complete frame: 0

2016-10-06 17:13:33.354 Metalplay PREPROD[25380:1142968] [FirebaseDatabase] Got data message: {

    b =     {

        d = "";

        s = ok;

    };

    r = 12;

}






Kato Richardson

unread,
Oct 6, 2016, 12:32:45 PM10/6/16
to Firebase Google Group
Hi Phillippe,

If the completion block isn't triggered, then the cancel block would contain an error. I'd start by adding that and seeing what comes out in the logs.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/9b4f692c-ba26-479a-956f-743b54e5938d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Philippe Fuentes

unread,
Oct 7, 2016, 1:59:33 AM10/7/16
to Firebase Google Group
Thanks for your quick answer Kato,

I'm sorry but I don't really understand, I'm not using observeEventType in this case, but setValue, I can't see a setValue method version with cancelBlock... 

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/9b4f692c-ba26-479a-956f-743b54e5938d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kato Richardson

unread,
Oct 7, 2016, 2:34:30 PM10/7/16
to Firebase Google Group

Yep, my fault. I missed that.

The next follow up would be, how are you verifying that call is even being invoked? I don’t see any logging or indication that you’ve verified newUserPlaylistUrlRef or that this code runs.

You might also try turning on debug logging for some additional info about what Firebase is up to:

JS:  firebase.database().enableLogging(true);
iOS:  [FIRDatabase setLoggingEnabled:YES];
Android:  FirebaseDatabase.getInstance().setLogLevel(Logger.Level.DEBUG);

☼, Kato


To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Kato Richardson

unread,
Oct 7, 2016, 3:45:40 PM10/7/16
to Firebase Google Group
Looks like you already posted this question on Stack Overflow. As a general rule of etiquette, you can show respect for the community's time by always letting developers know when you cross-post your questions. In this way, you can avoid multiple developers spending precious time typing out duplicate follow-up questions and replies.

Philippe Fuentes

unread,
Oct 7, 2016, 4:33:37 PM10/7/16
to Firebase Google Group
Well, the comment in my pasted code //completion block not called, this code is never reached...
states that the completionBlock is not executed, NSLog and other stuff happen in the 
completionBlock(key, error) call

And the console log I pasted is exactely the firebase log coming from 
[FIRDatabase setLoggingEnabled:YES];

Philippe Fuentes

unread,
Oct 7, 2016, 4:33:38 PM10/7/16
to Firebase Google Group
Ok, I'm sorry about that, tell me what what I can do regarding this cross-post.
maybe close this thread and continue on stackoverflow (I'm quite new there) ?




--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Kato Richardson

unread,
Oct 7, 2016, 5:40:34 PM10/7/16
to Firebase Google Group
Hey Phillippe,

Cross-posting is fine. Just link them so everyone is aware.

For simplicity, let's try to answer this one on Stack Overflow. It's a little easier to read the output there. Let me dig in and get back to you. I do see the setValue() and reply in the logs.

☼, Kato





To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Philippe Fuentes

unread,
Oct 8, 2016, 1:05:15 AM10/8/16
to Firebase Google Group
Thanks a lot for your time Kato.

Philippe Fuentes

unread,
Oct 8, 2016, 2:30:43 PM10/8/16
to Firebase Google Group
Ok my problem is solved by upgrading firebase SDK, details are here:


Thanks a lot 
Reply all
Reply to author
Forward
0 new messages