【发布时间】:2012-07-11 12:42:45
【问题描述】:
我正在尝试阅读,并且还需要写入 plist。
到目前为止,我正在尝试简单地阅读其中的内容。
这是我的 appSettings.plist:
NSBundle* bundle = [NSBundle mainBundle];
NSString* plistPath = [bundle pathForResource:@"appSettings" ofType:@"plist"];
NSDictionary *tmp = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
我尝试过这样做:
NSArray *mruItems = [[NSArray alloc] initWithArray:[tmp objectForKey:@"lastSearches"]];
但它会引发错误。我对 [tmp objectForKey:@"lastSearches"] 类型的检查显示这不是 NSArray...
如何将内容读入我的 NSArray?
谢谢!
(我也想知道一些写作方面的信息)
【问题讨论】:
-
我可能将 lastSearches 设为字典而不是数组...
标签: objective-c ios nsarray