My app uses firebase\'s observeSingleEventOfType quite a fair bit and I came to realise that my app\'s memory increase over time. I have commented out all my code except a test
I think this way it will help in xcode too. I have done in my android application.
DatabaseReference ref = FirebaseDatabase.getInstance().getReference("BLAH_BLAH_STRING");
// Attach a listener to read the data at our posts reference
ref.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// Do Some Stuff
ref.removeEventListener(this);
ref = null;
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
Or in iOS , I guess they have different methods to be used.
removeAllObservers and removeObserverWithHandle:
Please try with the given two methods above.