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,
- is there way disable auto sync , update when user click button?
- is there way update new or modified elements instead of re-download everything?
2-bis. there way know each element has been added/modified?
- 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()
yes. can programmatically control when data gets loaded using
observesingleeventoftype
.not when using
observesingleeventoftype
, because you're disabling firebase's cache.firdatasnapshot
not conform nscoding protocol
Comments
Post a Comment