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

前端之家收集整理的这篇文章主要介绍了iOS更改捆绑标识符使用PlistBuddy无法正常工作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试以编程方式更改我的XCode项目的包标识符.

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

但我一直得到错误

Set: Entry,“:CFBundleIndentifier”,Does Not Exist

这就是我的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标识符.我需要在脚本中添加它.

解决方法

你拼错了钥匙的名字.它应该是CFBundleIdentifier而不是CFBundleIndentifier
原文链接:https://www.f2er.com/iOS/331441.html

猜你在找的iOS相关文章