Re: plist files
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
propertyListFrom
Data: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.
References: | |
| >plist files (From: John MacMullin <email@hidden>) |