Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a boolean property in Info.plist from a User Defined Setting

It's simple to set a property in an Info.plist file from a user defined setting, you just use ${YOUR_SETTING_NAME} as the value. However, is it possible to do this for a bolean property? The structure in the plist file for a boolean is:

<key>NSAppleScriptEnabled</key>
<false/>

It's not clear how to use a user defined setting here.

like image 709
edoloughlin Avatar asked Dec 02 '09 10:12

edoloughlin


2 Answers

I'm not sure how to do what you're asking, but I'm pretty sure that for this particular key (NSAppleScriptEnabled) you can also use strings "YES" and "NO" and it will work.

like image 154
Ken Aspeslagh Avatar answered Nov 18 '22 18:11

Ken Aspeslagh


plist files containing booleans within tags are not valid any more.

This solution works:

Add a new Run Script Build Phase to your target. Put in this:

if [ ${CONFIGURATION} = "Release" ]; then
/usr/libexec/PlistBuddy -c "Set :UIFileSharingEnabled NO" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
fi

So in my configuration, I'm setting the UIFileSharingEnabled to YES in my plist as a default and when I'm building for Release, then the step above happens and sets it to false.

like image 11
gasparuff Avatar answered Nov 18 '22 18:11

gasparuff