Link to home
Start Free TrialLog in
Avatar of techques
techques

asked on

How to keep application session and store data in sqlite in iphone app?

There are 4 buttons that let user to click. When he clicks one of the buttons, I want to save the button id or value in application session until he closes the app.

How can I do it?

Secondly, how can I insert, update, delete, select data in sqlite in iphone app?

Avatar of pgnatyuk
pgnatyuk
Flag of Israel image

I think you need to split the question for two. There is no any relation between them
ASKER CERTIFIED SOLUTION
Avatar of msdcdev
msdcdev
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of techques
techques

ASKER

I think I do not need to use sqlite. How can I keep the value in a multi dimension arrays?

If you just need it for the life of the application (not after exit/relaunch), just use an app delegate variable.  Otherwise, create a core data entity and persist/retrieve the objects as necessary.  Here's a tutorial:

http://developer.apple.com/iphone/library/documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html

Multi dimension arrays can be solved with related entities.  For example, a widget group has widgets, and each widget has components.  You'd model a WidgetGroup, a Widget, and a WidgetComponent entity, and model the relationships accordingly (setting the multiplicity to one-to-many, or even many-to-many).
Dear Sir

I read http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html

but still not understand how to assign a UIButton value to a delegate variable.

I do not need core data entity.

I just want to create a global variable and can get it across ViewController.m

Do you know any online tutorial in youtube or somewhere else?
Thanks for your great help.