1、上周已经完成了北京米动同学,新的需求关于iOS打包inhouse和adhoc。本周有需要更改info.plist中文件里面dict内的字段的值,以CFBundleURLSchemes为例。
解决过程:
由于之前一直用的是/usr/libexec/PlistBuddy
,但是之前用到的地方是修改bundleid,但是现在要更改的是在dict内,之前在string,很简单的过程,先使用/usr/libexec/PlistBuddy -h
。注意到这里:
1 2 3 4 5
| Entry Format: Entries consist of property key names delimited by colons. Array items are specified by a zero-based integer index. Examples: :CFBundleShortVersionString :CFBundleDocumentTypes:2:CFBundleTypeExtensions
|
原来dict内的字段修改需要这样改,那么解决方案随之而来:
1 2 3 4
| bundleURLSchemes=$(/usr/libexec/PlistBuddy -c "print CFBundleURLTypes:0:CFBundleURLSchemes:0" "${project_infoplist_path}") if [ "${bundleURLSchemes}" != "xxx" ]; then /usr/libexec/PlistBuddy -c "set CFBundleURLTypes:0:CFBundleURLSchemes:0 'xxx'" "${project_infoplist_path}" fi;
|