plist writing data inside dictionary

Is it possible to edit values in our pList file in bundle or in our resources through code? This means that my plist file is NOT created programmatically and I want to edit its values programmatically.

Answers


In your app bundle, no: you can't write files inside your app bundle.

However, you can copy the file to the Documents or Library directory of the app sandbox upon the first launch on your app, then edit the plist file from there -- wheter it was created by code or by hand is unimportant.


I did something like this in my app. I created a plist which was basically a bunch of levels for my game. Each level was an array, with a whole bunch of different attributes like NSNumbers and NSStrings, etc. I add the original plist to my app bundle, but then when the user first launches the app, I create a copy of the plist and store it as a dictionary with Core Data. Then I can load and save all my data into the Core Data copy of the plist.

All the changes you make to the plist are saved in the Core Data, but the original plist is unchanged, so you have to make sure that once you have a saved game file, you load that instead of the plist. the plist only ever gets read once.


try with this link. You can update the values in plist as will as add & delete too.


Need Your Help

Post message on my friends wall with sdk 3.5 android

android facebook facebook-graph-api

i want to post message on my friends wall , I got my friend list and their Id now i am using the below code but it not posting any message to my any of friend wall, i'll post my code, in my above c...

shouldOverrideUrlLoading does not work/catch link clicks while page is loading

android android-webview webviewclient

I am using WebViewClient.shouldOverrideUrlLoading to catch any link clicks in the WebView. This works about 95% of the time, but sometimes it is simply not called.