2011-07-08 18 views
2

バイナリplistファイルをNSDictionary表現に解析する簡単な方法はありますか? 私はそのようなものを探しています:バイナリplistファイルを解析中バイナリplistをNSDictionaryに読み込む

NSString* strings = [NSString stringWithContentsOfURL: ... encoding: NSUnicodeStringEncoding error: ...]; 
NSMutableDictionary* pairs = (NSMutableDictionary*)[strings propertyListFromStringsFileFormat]; 

このコードを使用して例外を発生させました。

答えて

7

[NSDictionary dictionaryWithContentsOfFile:]をお探しですか?

+1

はい、私はを。ありがとう:) –

3

あなたが使用することができ、DataStorageFile.plistと呼ばれるファイルを考慮:

NSString *dataPath = [[NSBundle mainBundle] pathForResource:@"DataStorageFile" ofType:@"plist"]; 
self.data = [NSDictionary dictionaryWithContentsOfFile:dataPath]; 

あなたは配列したい場合:

self.data = [NSArray arrayWithContentsOfFile:dataPath]; 
関連する問題