Hi,

there is no "isEmpty" or so:
http://aerogear.org/docs/specs/aerogear-ios/Protocols/AGStore.html

However, that would be a good enhancement. Do you mind filing a JIRA against the AGIOS component ?

Thanks!
Matthias


On Thu, Jun 13, 2013 at 7:46 PM, Yavuz Selim YILMAZ <yavuzsel@buffalo.edu> wrote:
Hi,

Thanks for the answers. I have another question if you don't mind. When I create the myStore like in your examples, do I have any indication that the store is not empty (i.e. it is loaded from already existing plist store)? I can readAll from the store and check the count, but is there any better way to get it? (maybe a side question, is readAll efficient in this case?)

I appreciate your help. Bests,


---
Yavuz Selim Yilmaz
SUNY at Buffalo
Computer Science and Engineering
PhD Candidate

On Jun 7, 2013, at 2:42 AM, Christos Vasilakis <cvasilak@gmail.com> wrote:

Hi Yavuz.

thanks for trying out our library!

The issue here is that you don't, when you reload the app, specify the type of the store, you just give the name. The library doesn't remember names and types of stores. For this to work you need o specify the type of store as in the case when you created.  That is:

// create the datamanager
AGDataManager* dm = [AGDataManager manager];
// initialise store
id<AGStore> myStore = [dm store:^(id<AGStoreConfig> config) {
[config setName:@"tasks"];
[config setType:@"PLIST"];
}]

Now, If the PLIST store with name 'tasks'  exist on disk it will be initialised with the values you have inserted prior to termination and you can access them as normal.

Thanks
Christos



On Jun 7, 2013, at 12:15 AM, Yavuz Selim YILMAZ <yavuzsel@buffalo.edu> wrote:

thank you for your response Matthias. i want to clarify my first question more. so, i created my data store like this when user launched the app.

// create the datamanager
AGDataManager* dm = [AGDataManager manager];
// add a new (default) store object:
id<AGStore> myStore = [dm store:^(id<AGStoreConfig> config) {
    [config setName:@"tasks"];
    [config setType:@"PLIST"];
}]

then user switched to some other app and my app eventually terminated. then user came back to my app again. how do i retrieve the data store i created above? does this work (seems like it won't, as i lost my data manager above):

// create the datamanager
AGDataManager* dm = [AGDataManager manager];
// add a new (default) store object:
id<AGStore> myStore = [dm storeWithName:@"tasks"]


---
Yavuz Selim Yilmaz
SUNY at Buffalo
Computer Science and Engineering
PhD Candidate

On Jun 6, 2013, at 5:03 PM, Matthias Wessendorf <matzew@apache.org> wrote:




On Thu, Jun 6, 2013 at 9:34 PM, Yavuz Selim YILMAZ <yavuzsel@buffalo.edu> wrote:
Hi All,

I am trying out the AeroGear iOS lib, and trying to achieve client side data persistency employing AeroGear as much as possible. Here are a few questions I have, and I would appreciate any comments, suggestions and/or directions:

- So, starting from the basic question, how can I retrieve my data stores once user leaves the app and comes back (or, can I do this at all)?

there are callbacks for the lifecycle of the app

 

-Then, what is the difference between "MEMORY" type data store and "PLIST" type one (especially considering my goal is data persistence)?


MEM -> run of the app;
PList -> property list => pers. storage on the file system (sandbox style)
 

- Or alternatively, considering what AeroGear provides for now, what would be the best approach to implement offline support for the client? (for now, what I know is the lib does not provide DataSync. so data consistency is what I will take care of on my own.)

store PList and use the "Reachability" class (Apple example OR https://github.com/tonymillion/Reachability)

-M

 

Thanks for your time to read (and to respond). Bests,

---
Yavuz Selim Yilmaz
SUNY at Buffalo
Computer Science and Engineering
PhD Candidate


_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev



--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf
_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev

_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev

_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev


_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev



--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf