Modify PRODUCT_BUNDLE_IDENTIFIER in project.pbxproj of Xcode

狂风中的少年 提交于 2019-12-31 01:15:15

问题


I'm trying to modify the project.pbxproj file of Xcode project using sed shell command on Mac Terminal to replace a string. I want to replace the field -

PRODUCT_BUNDLE_IDENTIFIER = com.example.71b9b4f2

to

PRODUCT_BUNDLE_IDENTIFIER = com.example.14a32d1e

Command used -

sed -i 's/com.example.71b94f2/com.example.14a32d1e/g' project.pbxproj

which produces the following output error-

sed: 1: "project.pbxproj": extra characters at the end of p command

I was earlier using Plistbuddy shell command to modify the field CFBUNDLEIDENTIFIER in info.plist but that doesn't change $(PRODUCT_BUNDLE_IDENTIFIER) in Xcode 7 build settings anymore.

My main aim is to modify the PRODUCT_BUNDLE_IDENTIFIER field of BUILD SETTINGS in Xcode using command line or any script.


回答1:


OSX requires the extension to be explicitly specified. The workaround is to set an empty string:

sed -i '' 's/com.example.71b94f2/com.example.14a32d1e/g' project.pbxproj


来源:https://stackoverflow.com/questions/32910416/modify-product-bundle-identifier-in-project-pbxproj-of-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!