Page 1 of 1

Reading and Writing CSV Files and their persistence ...

Posted: Sun Dec 08, 2013 7:23 am
by LC4iOS
14301-how-do-i-read-write-to-files-in-ios

Love the lessons.
Makes everything look so easy.

I'm about to try the lesson above in conjunction with installing a csv file to load buttons with text.
Say 6 buttons on a card.
Read in the csv values from the text file I installed with the app.
Then based up on the selection,
Load six more button text for that specific selection and display the same card with new text etc.

I would also like to save some data from user input and what screen they were on etc.

I'd like to save this data and have the saved data persist even after I update my app or install the app again etc.
Is it possible to do this in iOS?

I'll keep researching until I find it or someone points me in the right direction.

Re: Reading and Writing CSV Files and their persistence ...

Posted: Sun Dec 08, 2013 7:36 am
by LC4iOS
...
If they are only temporary files that are used during the execution of the application, then use the "temporary" path.
If the files are to remain accessible for each launch of the application, then use the "documents" path. This is where application specific information is stored that is also backed up by iTunes.
...
you can create folders within the documents folder. Have a look at the dictionary entry for: "create folder"

Re: Reading and Writing CSV Files and their persistence ...

Posted: Sun Dec 08, 2013 7:47 am
by Simon
Hi LC4iOS,
I'd like to save this data and have the saved data persist even after I update my app or install the app again etc.
Update Yes, Install No. That is an install after deleting the app. Once the app is deleted the documents folder is also deleted.
The rest you can do.

Simon

Re: Reading and Writing CSV Files and their persistence ...

Posted: Sun Dec 08, 2013 8:27 am
by LC4iOS
OK, so even on my own iPhone 5 that I own, I can't have a folder with a database on it that maybe multiple apps that come and go can access?



Just a follow up question.

If I just add another button to the Hello World app, build it, then install on my iOS device using Keychain Access by dragging an dropping on Applications under my device, its this considered an update or a new install.

Already found.
...
In the iOS Standalone Application Settings you can set the Internal App ID, by default this is com.yourcompany.yourapp.

This is what iOS uses to identify the app, if there is an app on the device with the same identifier as the app you are adding it will assume it is an update and overwrite the app on the device. You just need to make this ID different for each of your apps.

Re: Reading and Writing CSV Files and their persistence ...

Posted: Sun Dec 08, 2013 8:52 am
by Simon
I can't have a folder with a database on it that maybe multiple apps that come and go can access?
Not with Apples sandboxing. Now I have recently seen a shell method but that was OSx.
I think the idea is if you need it, then use iCloud or other online service.

Simon

Re: Reading and Writing CSV Files and their persistence ...

Posted: Sun Dec 08, 2013 9:46 am
by LC4iOS
Ah, yes of course.
A Client/Server solution.

Just a shame to waste all the room on 64gig iPhone 5.

Thanks for the replies.

Re: Reading and Writing CSV Files and their persistence ...

Posted: Sun Dec 08, 2013 9:58 am
by Simon
Just to be clear.
You can create your data file of any size (< what is available), you just cannot have multiple apps using that same data.

Simon

Re: Reading and Writing CSV Files and their persistence ...

Posted: Sun Dec 08, 2013 8:54 pm
by LC4iOS
Understood.
Many Thanks.

Re: Reading and Writing CSV Files and their persistence ...

Posted: Sun Dec 08, 2013 10:44 pm
by FourthWorld
Search Google fire"CSV must die". :)

Unless you need to support CSV because some other program you're working with offers no alternative, there are many better formats worth considering, even the humble yet efficient LiveCode stack file.

Re: Reading and Writing CSV Files and their persistence ...

Posted: Mon Dec 09, 2013 5:57 am
by LC4iOS
Hi Richard,

Thanks for NOT suggesting XML.
I was just trying to keep it simple and easy to read n write etc.

But it looks like LiveCode lessons and samples makes it easy to do all.

Re: Reading and Writing CSV Files and their persistence ...

Posted: Mon Dec 09, 2013 6:27 am
by FourthWorld
LC4iOS wrote:Thanks for NOT suggesting XML.
If you ever see me recommending XML for any system where it's not absolutely required, that'll be your clue that the pod people have replaced me, and you can safely ignore anything that imposter writes. ;)

Re: Reading and Writing CSV Files and their persistence ...

Posted: Fri Dec 20, 2013 10:38 pm
by LC4iOS
LOL. Will do.

I've moved on to LiveCode SQLite samples.
If You can read and copy n paste its embarrassing how easy it is.

I've caught myself a number of times trying to do it my way.
Finding out its much easier to follow the samples and do it the LiveCode way.