views:

136

answers:

1

I have a TestData.plist stored in the resource folder and when the content is displayed in the textview i want it to be editable in a sense that user can edit and save the text on textview to the same TestData.plist file. what is the best way to do it?I am a total noob in iphone dev. Need help please..

A: 

You cannot save it to the same TestData.plist. Resources included with your app are read-only.

What you should do is copy the TestData.plist to the ~/Documents directory and have the working copy there. Like when your app starts, do the following:

if ~/Documents/TestData.plist does not exist:
    copy Testdata.plist to ~/Documents/TestData.plist
open ~/Documents/TestData.plist

You can find the ~/Documents directory with:

NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)

Having your 'document' in ~/Documents also means that it will be backed-up by iTunes when the user synchronizes his or her device.

St3fan
yea my files are in the documents directory...but each time the app run the folder varies..how could i make it a way that it only update on that particular folder/files?
summer
What do you think the NSSearchPathForDirectoriesInDomains() directory does?
St3fan