• 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: plist files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plist files


  • Subject: Re: plist files
  • From: Satoshi Matsumoto <email@hidden>
  • Date: Fri, 30 Jan 2004 15:40:27 +0900

on 04.1.30 0:53 PM, John MacMullin at email@hidden wrote:
> Is there a way to store a plist file in some other place than the
> applications' build file? And if so, how does one do this?

The document is available at

ADC Home > Documentation > Cocoa > Data Management > Archives and
Serializations> Serializing Objects

And sample code is:

saving a dictionary as a plist file at thePath

NSData *plistData;
NSString *error;
plistData =[NSPropertyListSerialization
dataFromPropertyList:dictionary
format:kCFPropertyListXMLFormat_v1_0
errorDescription:&error];
[plistData writeToFile:thePath atomically:YES];
......

loading a plist file at thePath as a dictionary

NSData *plistData;
plistData = [NSData dataWithContentsOfFile:thePath];
if( plistData ){
NSDictionary *dictionary;
NSString *error;
NSPropertyListFormat format;
dictionary = [NSPropertyListSerialization
propertyListFromData:plistData
mutabilityOption:NSPropertyListImmutable
format:&format
errorDescription:&error];
.......
}


Satoshi

-----------------------------------------------------
Satoshi Matsumoto <email@hidden>
816-5 Odake, Odawara, Kanagawa, Japan 256-0802
_______________________________________________
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.

  • Follow-Ups:
    • Re: plist files
      • From: Georg Tuparev <email@hidden>
References: 
 >plist files (From: John MacMullin <email@hidden>)

  • Prev by Date: Re: Updating the Desktop
  • Next by Date: Re: Updating the Desktop
  • Previous by thread: plist files
  • Next by thread: Re: plist files
  • Index(es):
    • Date
    • Thread