2.tools-plistBuddy

2.tools-PlistBuddy

the plist buddy is convince for us operator the plist file in Xcode, we can use the plist buddy command set/add/delete the plist key-value, and wrapper it in the build phases shell scripts

description:

/usr/libexec/PlistBuddy --help

Set :CFBundleIdentifier com.apple.plistbuddy

//Sets the CFBundleIdentifier property to com.apple.plistbuddy

Add :CFBundleGetInfoString string "App version 1.0.1"

//Adds the CFBundleGetInfoString property to the plist

Add :CFBundleDocumentTypes: dict

//Adds a new item of type dict to the CFBundleDocumentTypes array

Add :CFBundleDocumentTypes:0 dict

//Adds the new item to the beginning of the array

Delete :CFBundleDocumentTypes:0 dict

//Deletes the FIRST item in the array

Delete :CFBundleDocumentTypes

Deletes the ENTIRE CFBundleDocumentTypes array


# Disable File Sharing for app store builds

if [ "$BuildCondition" = "APP_STORE" ]

then

/usr/libexec/PlistBuddy -c "Set :UIFileSharingEnabled false" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"

echo "Disabled file sharing (UIFileSharingEnabled) in ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"

else

/usr/libexec/PlistBuddy -c "Set :UIFileSharingEnabled true" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"

echo "Enabled file sharing (UIFileSharingEnabled) in ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"

fi

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
禁止转载,如需转载请通过简信或评论联系作者。

推荐阅读更多精彩内容