Xcode 7: changing product bundle identifier Xcode 7: changing product bundle identifier xcode xcode

Xcode 7: changing product bundle identifier


Faced the same problem.

The PRODUCT_BUNDLE_IDENTIFIER is a variable in your project.pbxproj file. Change that to whatever you want and it will reflect both in your Info.plist as well as the project settings.


udit's answer is correct. The best practice is in plist set Bundle ID value as $PRODUCT_BUNDLE_IDENTIFIER. Then in Build Settings, use different configurations(Debug, Release .etc) to set up different bundle ID by required:enter image description here

You don't need xCode plugin to change bundle id anymore but need to specify configuration in there.

enter image description here


Refer to this for a simple solution to replace $PRODUCT_BUNDLE_IDENTIFIER using shell command like -

sed -i '' 's/com.example.oldbundleid/com.example.newbundleid/g' project.pbxproj

You can pass your variables accordingly using Jenkins/Shell.

Alternative approach to do this is using mod-pbxproj.

python -m mod_pbxproj -b -af PRODUCT_BUNDLE_IDENTIFIER=com.example.newbundleid -rf PRODUCT_BUNDLE_IDENTIFIER=com.example.oldbundleid project.pbxproj All

//edit

Old bundle id can be fetched by -

awk -F '=' '/PRODUCT_BUNDLE_IDENTIFIER/ {print $2; exit}' project.pbxproj

This can be stored in a string variable and used in place of com.example.oldbundleid