[aerogear-dev] iOS client side data persistence

Matthias Wessendorf matzew at apache.org
Fri Jun 7 02:41:04 EDT 2013


Yes,

here is an simple example:

https://gist.github.com/matzew/80ef7d756c15ca774907

Run a simple app like that in Xcode:

1) in "application:didFinishLaunchingWithOptions" we create the
(persistent) PList store
2) once the app becomes "active",the "didFinishLaunch" log statement shows
an empty store (surprise :))
2a) Afterwards, we save some values into the store (note:
the entry requires @"id" as it's field...).
3) Now, on your phone, kill the iOS app (see [1] if not sure how to do that)
4) start the app, via Xcode, again - and see the "didFinishLaunch" log
statement now shows the values, we stored before on the "
applicationDidBecomeActive" delegate function.


Do you think we should be more clear on this in our docs ?

-Matthias

[1] http://www.imore.com/daily-tip-close-backgrounded-app-ios-5




On Thu, Jun 6, 2013 at 11:15 PM, Yavuz Selim YILMAZ <yavuzsel at 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 at apache.org> wrote:
>
>
>
>
> On Thu, Jun 6, 2013 at 9:34 PM, Yavuz Selim YILMAZ <yavuzsel at 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 at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20130607/cd25db40/attachment-0001.html 


More information about the aerogear-dev mailing list