Comments (9)
Thanks for sending over this issue. While I understand that this can be frustrating, this is expected behavior. Single even observers will return data from the cache if there is data available. This allows us to fire them immediately. If you use .value observers, you will receive updated data in its second call.
from firebase-ios-sdk.
I suppose this makes sense. But, is there a way to do have it pull from the server immediately/initially, without having to call it twice? Am I suppose to use the non-single event methods, then cancel the observer manually?
Also, I would say the documentation should be updated.
from firebase-ios-sdk.
Any update?
from firebase-ios-sdk.
@MarksCode What kind of update are you looking for? This issue was closed as "expected behavior". stackoverflow is a better place to ask usage questions.
from firebase-ios-sdk.
Is there a better way of doing this? I've noticed that when using a cache and attempting a singleEvent
query, it can take 55-60 attempts before fresh data is returned.
from firebase-ios-sdk.
@quanvo87 load time is going to depend on the size of the data you're loading and the quality of your internet connection. Are you observing one minute load times for small queries on good internet?
from firebase-ios-sdk.
@morganchen12 When testing this, I was querying an endpoint that returned a small String. My connection is 15 ping 50/10 down/up. I could probably be more clear--by 55-60 attempts, what I mean is I did a ref.observeSingleEvent
, and in the callback, if !snapshot.exists()
, print something and repeat the function, until it finally got back data. The print statement executed 50+ times each test run. This is with persistence enabled. With persistence disabled, it just fires once.
from firebase-ios-sdk.
Oh, I misread your last comment.
With the current API, observing a single event with persistence enabled doesn't let you specify whether you're trying to retrieve cached or server data. The SDK defaults to returning cached data, but this isn't useful if you're trying to retrieve server data. For the time being you should use value listeners instead like Sebastian mentioned above, but this does seem like a non-feature.
from firebase-ios-sdk.
Thanks for sending over this issue. While I understand that this can be frustrating, this is expected behavior. Single even observers will return data from the cache if there is data available. This allows us to fire them immediately. If you use .value observers, you will receive updated data in its second call.
Why in the Second call? As we expect refreshed data whenever we apply the observer to the Database Reference. I tried below code too, its also not refreshing the data
weak var weakSelf = self
valueRef = dbRef?.observe(.value) { (snapShotData) in
if singleValueObserver
{
weakSelf?.dbRef?.removeObserver(withHandle: weakSelf?.valueRef ?? 0)
}
weakSelf?.dataFetched(snapShotData)
}
from firebase-ios-sdk.
Related Issues (20)
- Nightly Testing Report HOT 1
- Privacy manifest is missing for FirebaseAnalyticsOnDeviceConversion HOT 2
- Instructions for Firebase iOS Swift Package Manager dSYM upload script is wrong HOT 2
- Data injection vulnerability HOT 4
- Compiler version HOT 2
- [FR]: Change name request, code with name that exactly matches with "required reason API description" HOT 2
- App crashed due to Firebase SDK HOT 4
- After upgrade to 10.24.0 version to became compiler error HOT 2
- Nightly Testing Report HOT 2
- We have identified a freezing issue on iOS HOT 3
- Swift 5.9.2( Xcode 15.2) compilation issue with v10.24.0 using Carthage XCFramework HOT 12
- ‘FIRAnalytics+AppDelegate.h' is beyond a symbolic link (from Cocoapods in ver10.24.0) HOT 4
- [FR]: Add Apple privacy manifest for FirebaseAppCheck HOT 2
- Firestore uses the File timestamp APIs but has not provided a reason in the privacy manifest. HOT 2
- Privacy Manifest for GoogleAppMeasurementOnDeviceConversion required reasons use HOT 2
- Nightly Testing Report HOT 2
- ErrorCode 17999 HOT 9
- SDK Error - 10.24.0 - Fetching newest settings failed with error: InstallationIDError - FirebaseSessionsError - 3 HOT 8
- FirebaseInAppMessaging pod installs FirebaseAnalytics/AdIdSupport HOT 6
- Firebase-related Required Reason API warning email (ITMS-91053: Missing API declaration) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase-ios-sdk.