0
在我的應用程序委託中,我尋找一個plist來導入並將它變成一個NSMutableDictionary。然後設置一個NSMutableDictionary
NSLog(@"Reading session file from main bundle");
NSString *plistPath = [Utilities localPathForFileName:kSessionFile];
NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:plistPath];
temp = (NSMutableDictionary *)[NSPropertyListSerialization
propertyListFromData:plistXML
mutabilityOption:NSPropertyListMutableContainersAndLeaves
format:&format
errorDescription:&errorDesc];
我的NSMutableDictionary保存到一個單獨的訪問整個應用程序
[[self model] setStorage:temp];
這一切都工作正常,可以讓我隨意對象添加到字典中,因爲mutabilityOption的。我也寫給一個plist。第二次打開應用程序找到保存的plist並從那裏讀取。
我的問題是,我怎樣才能最初創建NSMutableDictionary具有相同的mutabilityOptions沒有從pList中讀取它?如果我能這樣做,那麼我也可以隨意擦除字典中的數據。在此先感謝您的幫助。
感謝。這會給我一個字典,我可以任意添加項目? – intomo 2011-01-23 00:01:44