Ian Warburton
Ian Warburton

Reputation: 15726

Can't access build setting

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

enter image description here

This gets picked up correctly in build settings...

enter image description here

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

enter image description here

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

enter image description here

Any ideas?

Upvotes: 1

Views: 987

Answers (1)

Ian Warburton
Ian Warburton

Reputation: 15726

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.

Upvotes: 1

Related Questions