2014-10-19 32 views
6

我試圖以編程方式更改我的XCode項目的包標識符。iOS更改包標識符使用PlistBuddy不工作

$的/ usr/libexec目錄/ PlistBuddy -c 「載:CFBundleIndentifier com.myIdentifier.appName」 MyApp的-Info.plist中

但我不斷收到錯誤 -

設置:條目「:CFBundleIndentifier」,不存在

這就是我的Info-Plist的外觀,它具有CFBu的條目ndleIndentifier。

<?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> 

也許我正在使用PlistBuddy錯誤。如何使用命令行更改XCode項目的Bundle標識符。我需要將它添加到腳本中。

+0

我試圖達到相同的功能,你是怎麼做到的?在Objective C中? – 2016-02-12 12:43:10

+0

@SaqibOmer他正在使用啓動PlistBuddy命令的腳本。您可以在目標的「構建」階段添加腳本階段 – CedricSoubrie 2017-04-24 15:54:01

回答

5

您錯過了密鑰的名稱。它應該是CFBundleIdentifier而不是CFBundleIndentifier