PList Chicken/Egg Scenario

Posted by David van Dugteren on Stack Overflow See other posts from Stack Overflow or by David van Dugteren
Published on 2010-05-18T06:40:39Z Indexed on 2010/05/18 6:50 UTC
Read the original article Hit count: 364

Filed under:
|
|
|
|

Hi, I want to read/write to cache.plist

If I want to read an existing premade plist file stored in the resources folder I can go:

path = [[NSBundle mainBundle] bundlePath];
NSString *finalPath = [path stringByAppendingPathWithComponent@"cache.plist"];
NSMutableDictionary *root = ...

But then I wish to read it from the iPhone.

Can't, the Resources folder is only readable.

So I need to use:

NSDocumentDirectory, NSUserDomain,YES

So how can I have my plist file preinstalled to the Document Directory location?

Thus meaning I don't have to mess around with untidy code copying the plist file over at startup. (Unless that's the only way).

© Stack Overflow or respective owner

Related posts about iphone

Related posts about plist