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?

CiPhoneSwift Programming

Avatar of undefined
Last Comment
techques

8/22/2022 - Mon
pgnatyuk

I think you need to split the question for two. There is no any relation between them
ASKER CERTIFIED SOLUTION
msdcdev

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
techques

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

msdcdev

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).
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
techques

ASKER
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?
techques

ASKER
Thanks for your great help.