iOS : Objective-C : Firebase : Is it possible to read the cached data first for any reference?

一世执手 提交于 2019-12-02 08:10:42

问题


@Description:

I have data already exists at some endpoint(friends_list) so this is my reference :

https://xxxxxx.firebaseio.com/friends_list

Now, I have enabled disk persistence i.e., i am allowed to cache the data as well as using the below code:

 [FIRDatabase database].persistenceEnabled = YES;

Now, I have loaded the application and I have cached the data to disk by using the following code:

 FIRDatabaseReference *globalRef = [[FIRDatabase database] reference];

 FIRDatabaseReference *ref = [globalRef child:@"friends_list"];
 [ref keepSynced:YES];

//here comes : other stuff for listeners (ChildAdded, ChildChanged, ChildRemoved)

I am able to cache the data, my question is when there is no internet I have to read the data from disk first and display them in my UI.

This is happening but there is a delay. Can some one help me on this.

Thanks.

来源:https://stackoverflow.com/questions/37742179/ios-objective-c-firebase-is-it-possible-to-read-the-cached-data-first-for

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!