Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
[basic] writeToFile .plist best method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[basic] writeToFile .plist best method



hi - I am writing a plist file and have some basic questions.

1- do I need to call my file a somefile.plist can I just give it my own extension like somefile.myfile?

2- I am allocating the file name dynamically, I did this like this:

fileName = [nameField stringValue];
[records writeToFile:[fileName stringByAppendingString:@".plist"] atomically:TRUE];

however when I construct a path name for the file as in I wish to save somefile.plist on the Desktop I am
doing it this way:

noting that records is a dictionary.

[records writeToFile:[ [ [@"~/Desktop/" stringByAppendingString:fileName] stringByAppendingString:@".plist"] stringByExpandingTildeInPath ] atomically:TRUE];

Is this the best way, just incase I have to many square braces?

-Kurt
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.