ios - how to define strings in xcconfig and quotes -


i've started using xcconfig file environment specific build settings , noticed string quotes literally interpreted.

e.g.

app_bundle_displayname_suffix = "debug"

will show app name of myapp "debug" display name (with quotes)

how handle strings in xcconfig file, necessary define strings? if not how deal empty spaces , escaping? special characters e aware of?

the answer depends on actual build setting you're trying change, , gets used.

as you've observed, setting app_bundle_displayname_suffix can take single word, , adding quotes here results in them being incorporated xcode value of setting.

however, in other places different. particularly, if setting passed onto toolchain during build. in these cases, have use quoting , escaping both xcode and command-line.

for example: if want use xcconfig file set preprocessor definitions (i.e. macros) , want define string macro, have escape quotes shell doesn't strip them, , if have slashes in string have escape these because xcode interprets them internally.

suppose in code have:

#ifdef my_macro1 const char *my_url = my_macro2; #endif 

then xcconfig file work correctly:

// //  my_string_macro.xcconfig //  gcc_preprocessor_definitions=my_macro1 my_macro2="\"https:\/\/stackoverflow.com\/questions\/30926076\/\""  

xcode's build settings inspector show value between outermost 2 double quotes unchanged, correctly interpreted during compilation, leading in compile log:

clang -x objective-c++ -dmy_macro1 -dmy_macro2=\"https://stackoverflow.com/questions/30926076/\" 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -