Can't access build setting

对着背影说爱祢 提交于 2019-12-11 10:51:46

问题


Here's an entry in my config file...

This gets picked up correctly in build settings...

I've referenced the setting in both Info.plist files for the project...

But upon execution of the test target, the value isn't there...

Any ideas?


回答1:


The code was looking in the wrong bundle.

This answer gave me the solution...

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

This was the code I used instead...

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

I only needed the entry in the Info.plist for my test target which is where the above code was defined.

Additionally, I didn't need quotes around the value in the config file.



来源:https://stackoverflow.com/questions/33220964/cant-access-build-setting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!