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的条目.

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3. <plist version="1.0">
  4. <dict>
  5. <key>CFBundleDevelopmentRegion</key>
  6. <string>en</string>
  7. <key>CFBundleDisplayName</key>
  8. <string>${PRODUCT_NAME}</string>
  9. <key>CFBundleExecutable</key>
  10. <string>${EXECUTABLE_NAME}</string>
  11. <key>CFBundleIcons</key>
  12. <dict>
  13. <key>CFBundlePrimaryIcon</key>
  14. <dict>
  15. <key>CFBundleIconFiles</key>
  16. <array>
  17. <string>Icon-120</string>
  18. <string>Icon.png</string>
  19. <string>Icon@2x.png</string>
  20. <string>Icon-iPad.png</string>
  21. <string>Icon-iPad@2x.png</string>
  22. </array>
  23. </dict>
  24. </dict>
  25. <key>CFBundleIcons~ipad</key>
  26. <dict>
  27. <key>CFBundlePrimaryIcon</key>
  28. <dict>
  29. <key>CFBundleIconFiles</key>
  30. <array>
  31. <string>Icon-152</string>
  32. <string>Icon-76</string>
  33. <string>Icon-120</string>
  34. <string>Icon.png</string>
  35. <string>Icon@2x.png</string>
  36. <string>Icon-iPad.png</string>
  37. <string>Icon-iPad@2x.png</string>
  38. </array>
  39. </dict>
  40. </dict>
  41. <key>CFBundleIdentifier</key>
  42. <string>com.myOldIdentifier.app</string>
  43. <key>CFBundleInfoDictionaryVersion</key>
  44. <string>6.0</string>
  45. <key>CFBundleName</key>
  46. <string>${PRODUCT_NAME}</string>
  47. <key>CFBundlePackageType</key>
  48. <string>APPL</string>
  49. <key>CFBundleShortVersionString</key>
  50. <string>3.0.12</string>
  51. <key>CFBundleSignature</key>
  52. <string>????</string>
  53. <key>CFBundleVersion</key>
  54. <string>1.0</string>
  55. <key>LSApplicationCategoryType</key>
  56. <string></string>
  57. <key>LSRequiresIPhoneOS</key>
  58. <true/>
  59. <key>UIAppFonts</key>
  60. <array>
  61. <string>Gotham-Bold.otf</string>
  62. <string>Gotham-BoldItalic.otf</string>
  63. <string>Gotham-Book.otf</string>
  64. <string>Gotham-BookItalic.otf</string>
  65. <string>Gotham-Light.otf</string>
  66. <string>Gotham-LightItalic.otf</string>
  67. <string>Gotham-Medium.otf</string>
  68. <string>Gotham-MediumItalic.otf</string>
  69. </array>
  70. <key>UIApplicationExitsOnSuspend</key>
  71. <false/>
  72. <key>UIStatusBarHidden</key>
  73. <true/>
  74. <key>UIStatusBarStyle</key>
  75. <string>UIStatusBarStyleBlackOpaque</string>
  76. <key>UISupportedInterfaceOrientations</key>
  77. <array>
  78. <string>UIInterfaceOrientationPortrait</string>
  79. <string>UIInterfaceOrientationPortraitUpsideDown</string>
  80. <string>UIInterfaceOrientationLandscapeLeft</string>
  81. <string>UIInterfaceOrientationLandscapeRight</string>
  82. </array>
  83. <key>UISupportedInterfaceOrientations~ipad</key>
  84. <array>
  85. <string>UIInterfaceOrientationLandscapeLeft</string>
  86. <string>UIInterfaceOrientationLandscapeRight</string>
  87. </array>
  88. <key>UIViewControllerBasedStatusBarAppearance</key>
  89. <true/>
  90. </dict>
  91. </plist>

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

解决方法

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

猜你在找的iOS相关文章