无法访问生成设置

这是我的configuration文件中的一个条目…

在这里输入图像说明

这在构build设置中正确拾取…

在这里输入图像说明

我已经在项目的Info.plist文件中引用了该设置…

在这里输入图像说明

但是在执行testing目标时,值不存在

在这里输入图像说明

有任何想法吗?

代码看着错误的包。

这个答案给了我解决scheme…

https://stackoverflow.com/a/30687916/221683

这是我用的代码…

 let urlString = NSBundle(forClass: self.dynamicType).objectForInfoDictionaryKey("WebServiceUrl") as? String 

我只需要在Info.plist中input我的testing目标,就是上面代码的定义。

另外,我不需要在configuration文件中引用值。