2014-10-19 10 views
6

Sto provando a cambiare l'identificatore del bundle del mio progetto XCode a livello di codice.iOS Cambiare l'identificatore del pacchetto usando PlistBuddy non funziona

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

Ma io continuo a ricevere l'errore -

Set: Entry, ": CFBundleIndentifier", non esiste

Ecco come appare il mio Info-Plist e ha la voce per 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> 

Forse sto usando il PlistBuddy sbagliato. Come faccio a cambiare l'identificatore Bundle di un progetto XCode utilizzando la riga di comando. Devo aggiungerlo in una sceneggiatura.

+0

Sto cercando di ottenere la stessa funzionalità, come hai fatto? Nell'obiettivo C? –

+0

@SaqibOmer sta usando uno script che lancia un comando PlistBuddy. È possibile aggiungere una fase di script nelle fasi di creazione del target – CedricSoubrie

risposta

5

Hai dimenticato il nome della chiave. Dovrebbe essere CFBundleIdentifier e non CFBundleIndentifier

Problemi correlati