uchicago-mobi / 2015-Winter-Forum

8 stars 1 forks source link

Location for NSCoder ? #165

Closed psajja closed 9 years ago

psajja commented 9 years ago

I would like to know the location of the .plist file for the NSCoder ? I remember prof. showing us the location of the files associated with the simulator. I forget the location. Thanks.

JRam13 commented 9 years ago

I would also like to have this clarified. If you go the route where you're writing to the Document's directory (as shown below), I don't think you have access to that plist. I also don't think it's possible to write to your bundles directory either. My hunch is you won't be able to see that plist. I think what you saw in class was a pre-made plist file for demonstration purposes.

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *appFile = [documentsDirectory stringByAppendingPathComponent:FAVORITE_LIST_NAME];

[NSKeyedArchiver archiveRootObject:yourFavoriteList toFile:appFile];
.
..
...
psajja commented 9 years ago

Thanks Jonny.