ios - Xcode:无法更改项目版本

标签 ios objective-c xcode

我无法更改项目的版本。 我尝试使用 Target->General->[Version and Build]

更改版本

enter image description here

此外,我尝试更改 AppName-info.plist 中的版本

enter image description here

但是,当我存档这个项目时,我得到了错误版本的构建

enter image description here

当我尝试提交到 Appstore 时,出现此错误

enter image description here

如何解决?我们将不胜感激!

最佳答案

我解决了我的问题。 在“目标”->“构建阶段”中我找到了脚本

git=$(sh /etc/profile; which git)
git_release_version=$("$git" describe --tags --always --abbrev=0)
number_of_commits=$("$git" rev-list master | wc -l | tr -d ' ')
target_plist="$TARGET_BUILD_DIR/$INFOPLIST_PATH"
dsym_plist="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist"

for plist in "$target_plist" "$dsym_plist"; do
  if [ -f "$plist" ]; then
    /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $number_of_commits" "$plist"
    /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${git_release_version#*v}" "$plist"
  fi
done

然后我就把它删除了。

关于ios - Xcode:无法更改项目版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32739604/

相关文章:

ios - 制作链式动画的正确方法

objective-c - 将数组分配给变量,然后切换一系列条件语句

objective-c - 带有 png 叠加层的 xCode 视频播放器

ios - UISearchBar、textDidChange 事件、MultipleNSUrlConnection、在 tableView 上崩溃

ios - 刷新 3D Touch Quick Action 标题

ios - 使用 Swift 在 WebView 和 NativeView 之间切换

ios - AFNetworking 3.0 错误 : “Request failed: internal server error (500)”

iphone - 禁用除特定 View 之外的所有 super View

ios - Xcode 10 - 多个命令生成 .app

ios - 照片框架检查图像类型