【发布时间】:2012-09-25 09:03:25
【问题描述】:
我使用的是 xCode 3.2,然后移至 xCode 4.2 并从 Settings.bundle 获取一些值......它工作正常。
虽然我需要编辑 Settings.bundle 中的一些值,但 Root.plist 文件没有显示,所以我按照以下步骤操作,但没有对文件进行任何更改。
1) Click on the Settings.Bundle file, go over to the utilities window,
and look in the File Inspector.
2) Using the drop-down, change the file type to 'Application Bundle'
之后我可以看到 Root.plist 但现在无法在应用程序中获取它的值。实际上得到 Null 而不是 value。
下面是Settings.bundle的代码和图片
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
host = [defaults stringForKey:@"meter_preference"];
if(host == nil)
{
host = @"10.20.20.1";
DDLogError(@"Meter host is nil from NSUserDefaults, defaulting to %@", host);
}
【问题讨论】:
标签: iphone objective-c ios xcode ipad