• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [basic] writeToFile .plist best method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [basic] writeToFile .plist best method


  • Subject: Re: [basic] writeToFile .plist best method
  • From: Nick Zitzmann <email@hidden>
  • Date: Wed, 28 Jul 2004 08:44:34 -0600

On Jul 28, 2004, at 1:53 AM, clunkyrobot wrote:

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

The extension shouldn't matter in this case.

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?

You don't have to many square braces, but you do have too many square braces. <;*) Try this instead:

[records writeToFile:[[NSString stringWithFormat:@"~/Desktop/%@.plist", fileName] stringByExpandingTildeInPath] atomically:YES];

Or this:

[records writeToFile:[NSString stringWithFormat:@"%@/Desktop/%@.plist", NSHomeDirectory(), fileName] atomically:YES];

Either way is much cleaner and does the same thing as you wrote above.

Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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.


References: 
 >[basic] writeToFile .plist best method (From: clunkyrobot <email@hidden>)

  • Prev by Date: Binding window title
  • Next by Date: Re: Crash with NSPrintOperation ?!
  • Previous by thread: [basic] writeToFile .plist best method
  • Next by thread: iTunes style custom class
  • Index(es):
    • Date
    • Thread