Xcode 7: changing product bundle identifier

后端 未结 6 830
执笔经年
执笔经年 2020-12-12 23:47

I\'m setting up Jenkins to automate the build process. In particular, for my needs, I\'d like to be able to set different bundle identifiers.

I\'m using the Xcode J

6条回答
  •  一生所求
    2020-12-13 00:27

    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

提交回复
热议问题