propertyListFromData:mutabilityOption:format:errorDescription:
データからプロパティリストをつくって返します
+(id)propertyListFromData:(NSData *)data mutabilityOption:(NSPropertyListMutabilityOptions)opt format:(NSPropertyListFormat *)format errorDescription:(NSString **)errorString
解説
データからプロパティリストをつくって返します。
【NSPropertyListFormat】
NSPropertyListOpenStepFormat
NSPropertyListXMLFormat_v1_0
NSPropertyListBinaryFormat_v1_0
【NSPropertyListMutabilityOptions】
NSPropertyListImmutable
NSPropertyListMutableContainers
NSPropertyListMutableContainersAndLeaves
返り値
( id )
オブジェクト
引数
( NSData * )data
( NSPropertyListMutabilityOptions )opt
ミュータブルオプション
( NSPropertyListFormat * )format
フォーマット
( NSString ** )errorString Returns a p
エラー
フレームワーク
Foundation
クラス
NSPropertyListSerialization
Class Methods
使用可能
10.2
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSString *error; NSData *serializationData; NSString *thePath = [[NSBundle mainBundle] pathForResource : @"theList" ofType:@"plist"]; NSData *plistData = [ NSData dataWithContentsOfFile : thePath ] ; if ([NSPropertyListSerialization propertyList:plistData isValidForFormat:NSPropertyListXMLFormat_v1_0 ]){ serializationData = [NSPropertyListSerialization dataFromPropertyList: plistData format: NSPropertyListXMLFormat_v1_0 errorDescription: &error]; } id obj = [NSPropertyListSerialization propertyListFromData:serializationData mutabilityOption:NSPropertyListMutableContainers format: nil errorDescription:nil ]; NSLog([ obj className]); } @end