iOS Changing Bundle Identifier using PlistBuddy not working
Asked Answered
G

1

7

I'm trying to change the bundle identifier of my XCode project programmatically.

$ /usr/libexec/PlistBuddy -c "Set :CFBundleIndentifier com.myIdentifier.appName" MyApp-Info.plist

But I keep getting the error -

Set: Entry, ":CFBundleIndentifier", Does Not Exist

This is how my Info-Plist looks like and it has the entry for CFBundleIndentifier.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundleExecutable</key>
    <string>${EXECUTABLE_NAME}</string>
    <key>CFBundleIcons</key>
    <dict>
        <key>CFBundlePrimaryIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>Icon-120</string>
                <string>Icon.png</string>
                <string>[email protected]</string>
                <string>Icon-iPad.png</string>
                <string>[email protected]</string>
            </array>
        </dict>
    </dict>
    <key>CFBundleIcons~ipad</key>
    <dict>
        <key>CFBundlePrimaryIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>Icon-152</string>
                <string>Icon-76</string>
                <string>Icon-120</string>
                <string>Icon.png</string>
                <string>[email protected]</string>
                <string>Icon-iPad.png</string>
                <string>[email protected]</string>
            </array>
        </dict>
    </dict>
    <key>CFBundleIdentifier</key>
    <string>com.myOldIdentifier.app</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>3.0.12</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>LSApplicationCategoryType</key>
    <string></string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UIAppFonts</key>
    <array>
        <string>Gotham-Bold.otf</string>
        <string>Gotham-BoldItalic.otf</string>
        <string>Gotham-Book.otf</string>
        <string>Gotham-BookItalic.otf</string>
        <string>Gotham-Light.otf</string>
        <string>Gotham-LightItalic.otf</string>
        <string>Gotham-Medium.otf</string>
        <string>Gotham-MediumItalic.otf</string>
    </array>
    <key>UIApplicationExitsOnSuspend</key>
    <false/>
    <key>UIStatusBarHidden</key>
    <true/>
    <key>UIStatusBarStyle</key>
    <string>UIStatusBarStyleBlackOpaque</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <true/>
</dict>
</plist>

Maybe I'm using the PlistBuddy wrong. How do I change the Bundle identifier of an XCode project using command line. I need to add it in a script.

Gooseherd answered 19/10, 2014 at 9:8 Comment(2)
I am trying to achieve the same functionality, how did you do that? In Objective C?Forgave
@SaqibOmer he's using a script that launches a PlistBuddy command. You can add a script phase in the Build phases of your targetLilias
S
6

You have misspelt the name of the key. It should be CFBundleIdentifier and not CFBundleIndentifier

Snare answered 19/10, 2014 at 17:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.