Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure full URLs in xcconfig files

I have an xcconfig file which contains a configuration for which server my app should hit. In debug mode, this will be a different server than for release builds.

The problem I have is that a URL of the form http://www.stackoverflow.com is treated as a comment after the double slash. So the string I get in code is 'http:'

I have read that I can put a -traditional build flag on Info.plist, I was wondering if someone else has had a similar issue and has solved it?

Thanks.

like image 235
atreat Avatar asked Jan 23 '14 19:01

atreat


People also ask

How do I add files to Xcconfig?

To create an xcconfig file, choose File -> New -> File... in your project. In the new file dialog, scroll down until you see the Configuration Settings File in the Other section. You can add configurations for pretty much anything you want.

What is Xcconfig?

Xcode build configuration files, more commonly known by their xcconfig file extension, allow build settings for your app to be declared and managed without Xcode. They're plain text, which means they're much friendlier to source control systems and can be modified with any editor.


2 Answers

Here's a simple workaround:

WEBSITE_URL = https:/$()/www.example.com
like image 198
David H Avatar answered Oct 21 '22 14:10

David H


I also could not figure out how to use a double slash in a xcconfig file. But I found a workaround in

  • Re: Double forward slashes in .xcconfig-defined build settings

from the Xcode-users mailing list: In the xcconfigfile, save the URL without the http scheme:

MYURL = stackoverflow.com

In the Info.plist, set the property value to

http://${MYURL}
like image 45
Martin R Avatar answered Oct 21 '22 14:10

Martin R