iOS更改捆绑标识符使用PlistBuddy无法正常工作

时间:2014-10-19 09:08:27

标签: ios xcode plist

我正在尝试以编程方式更改我的XCode项目的包标识符。

  

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

但我一直收到错误 -

  

设置:条目,“:CFBundleIndentifier”,不存在

这就是我的Info-Plist的样子,它有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>Icon@2x.png</string>
                <string>Icon-iPad.png</string>
                <string>Icon-iPad@2x.png</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>Icon@2x.png</string>
                <string>Icon-iPad.png</string>
                <string>Icon-iPad@2x.png</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>

也许我正在使用PlistBuddy错误。如何使用命令行更改XCode项目的Bundle标识符。我需要在脚本中添加它。

1 个答案:

答案 0 :(得分:6)

你拼错了钥匙的名字。它应该是 CFBundleIdentifier 而不是 CFBundleIndentifier