ios - Firebase 3 update local cache -


i'm working on ios app receives data firebase database. need keep local version of db , found awesome offline capability of firebase. now,

  1. is there way disable auto sync , update when user click button?
  2. is there way update new or modified elements instead of re-download everything?

2-bis. there way know each element has been added/modified?

  1. does firdatasnapshot conform nscoding protocol? i'd save locally in plist file...

edit:

after reading more in firebase 3 documentation, i'm looking db tree in single request, possible?

my code following

    firdatabasereference.goonline()         var firebase = firdatabase.database().referencewithpath("items")             firebase.observeeventtype(.value, withblock: { snapshot in                  print(snapshot.value)                  if let snapshots = snapshot.children.allobjects as? [firdatasnapshot] {                      snap in snapshots {                          if let postdictionary = snap.value as? dictionary<string, anyobject> {                             print ("item received")                         }                     }                 }             })  firdatabasereference.gooffline() 

  1. yes. can programmatically control when data gets loaded using observesingleeventoftype.

  2. not when using observesingleeventoftype, because you're disabling firebase's cache.

  3. firdatasnapshot not conform nscoding protocol


Comments