Firebase FQuery how do you detect when at the end of a list of nodes -


how detect when have finished processing found nodes when doing query? in following example, processing on each encountered node. when reach "end" of list able detect know it's finished.

fquery* messagelistquery = [m_firebaseref querylimitedtonumberofchildren:100]; [messagelistquery observeeventtype:feventtypechildadded andprevioussiblingnamewithblock:^(fdatasnapshot *snapshot, nsstring *prevnodename) {     // 1. interesting stuff snapshot data     // 2. want detect when i'm @ end of list know when i'm done processing list. }]; 

here example use case. load latest 100 messages in background. once messages have been loaded, update ui. however, i'm not sure how know messages have been loaded given there might less 100 messages in list.

i figured out how read messages front using observesingleeventoftype , iterating on children.

[m_firebaseref observesingleeventoftype:feventtypevalue withblock:^(fdatasnapshot *snapshot) {     nslog( @"name %@ %d children.", snapshot.name, snapshot.childrencount );      for( fdatasnapshot *child in snapshot.children )     {         nsdictionary *msgdata = child.value;          nsstring *message      = msgdata[kfirebaselivechatfieldmessage];         nsstring *gamertag     = msgdata[kfirebaselivechatfieldgamertag];         nsstring *gamecenterid = msgdata[kfirebaselivechatfieldgamecenterid];         nslog( @"preload = %@ (%@): %@", gamertag, gamecenterid, message );     } }]; 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -