swift - iOS firebase observer delays observing the changes in the node -
i have 1 function realtime location updates of selected user.
and in function , need call current status , history of selected user firebase.
so, problem when start observer location updates , it's fine , it's great . value firebase observer.
but , when make call current status , history of selected user , getting delay in firebase realtime observer .
i don't understand how come call firebase affecting our realtime observer code.
guys suggestions, tried dispatching background current status /history call still no luck.
left me hopeless , clueless.
added: getting current status , realtime observers same node. , happens same node observing , same time if firebase call made same node , colliding ???
updated
firebase function current status :
firdatabasereference().child("personal").child(useruuid).child("realtime") .observesingleevent(of: .value, with: { (snapshot) in //print(snapshot.key) if snapshot.exists(){ let location = locationparser(dict: snapshot.value as! [string : anyobject])?.location completion(location) }else{ completion(nil) } }){ (error) in completion(nil) debugprint(error.localizeddescription) }
firebase function observe location (continuously):
firdatabasereference().child("personal").child(useruuid).child("realtime") .observe(.value) { (snapshot:firdatasnapshot) in print("\nobserver firebase fired") if let value = snapshot.value as? [string:anyobject] { if let location = locationparser(dict: value)?.location { //we cannot save location our database //sharedfirebasemanager.savelocationhistoric(locationparser(dict: value)!) result(success(location)) } } }
question:
i calling both same controller , see continuous observer delays on calling firebase function call. clue.
Comments
Post a Comment