Xcode 11存档使PhaseScriptExecution失败 [英] Xcode 11 archive gives PhaseScriptExecution failed

查看:494
本文介绍了Xcode 11存档使PhaseScriptExecution失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode 10中将项目从swift 3.2迁移到swift 4之后,我尝试在Xcode 11中进行归档,并给我这个错误:

After I migrate my project from swift 3.2 to swift 4 in Xcode 10 I try to archive in Xcode 11 and give me this error:

PhaseScriptExecution Run \脚本 /Users/desarrollo/Library/Developer/Xcode/DerivedData/MyApp-iOS-ewcyzseaubkujucenluznpmduhoo/Build/Intermediates.noindex/ArchiveIntermediates/MyApp-iOS-DEV/IntermediateBuildFilesPath/MyApp-iOS.build/Release-iphoneos/MyApp-iOS-DEV .build/Script-E95AEDE51E54767F00B60429.sh (在项目"MyApp-iOS"中的目标"MyApp-iOS-DEV"中)

PhaseScriptExecution Run\ Script /Users/desarrollo/Library/Developer/Xcode/DerivedData/MyApp-iOS-ewcyzseaubkujucenluznpmduhoo/Build/Intermediates.noindex/ArchiveIntermediates/MyApp-iOS-DEV/IntermediateBuildFilesPath/MyApp-iOS.build/Release-iphoneos/MyApp-iOS-DEV.build/Script-E95AEDE51E54767F00B60429.sh (in target 'MyApp-iOS-DEV' from project 'MyApp-iOS')

. .

/Users/desarrollo/Library/Developer/Xcode/DerivedData/MyApp-iOS-ewcyzseaubkujucenluznpmduhoo/Build/Intermediates.noindex/ArchiveIntermediates/MyApp-iOS-DEV/IntermediateBuildFilesPath/MyApp-iOS.build/Release-iphoneos/MyApp-iOS iOS-DEV.build/Script-E95AEDE51E54767F00B60429.sh: 第5行:$(CURRENT_PROJECT_VERSION)+ 1:语法错误:预期操作数 (错误令牌为"$(CURRENT_PROJECT_VERSION)+1")

/Users/desarrollo/Library/Developer/Xcode/DerivedData/MyApp-iOS-ewcyzseaubkujucenluznpmduhoo/Build/Intermediates.noindex/ArchiveIntermediates/MyApp-iOS-DEV/IntermediateBuildFilesPath/MyApp-iOS.build/Release-iphoneos/MyApp-iOS-DEV.build/Script-E95AEDE51E54767F00B60429.sh: line 5: $(CURRENT_PROJECT_VERSION) + 1: syntax error: operand expected (error token is "$(CURRENT_PROJECT_VERSION) + 1")

在错误堆栈中,我找到了 export CURRENT_PROJECT_VERSION = 114

In the error stack I find export CURRENT_PROJECT_VERSION=114

我没有任何带有"$(CURRENT_PROJECT_VERSION)+ 1"的脚本,所以我不知道该怎么做

I don't have any script with "$(CURRENT_PROJECT_VERSION) + 1" so I don't know what to do

推荐答案

更新2:

这将导致构建被取消!在下面查看S1LENT WARRIOR的答案,看来效果更好.

This causes builds to be canceled! Have a look at S1LENT WARRIOR's answer below, it seems to be working better.

更新1:

在最新版本的Xcode(版本11.1)中,您可以相当轻松地实现内部版本号的自动递增.

In the latest version of Xcode (Version 11.1) you can do the build number auto increment fairly easily.

以下是步骤:

  1. 转到目标的Build Settings
  2. 搜索Versioning System
  3. 将其值设置为Apple Generic
  4. 转到目标的Build Phases
  5. 添加新的运行脚本
  6. 添加以下行agvtool next-version -all
  1. Go to your target's Build Settings
  2. Search for Versioning System
  3. Set it's value to Apple Generic
  4. Go to your target's Build Phases
  5. Add a new Run Script
  6. Add the following line agvtool next-version -all

对所有目标执行此操作,并且每次运行任何目标时,它们的内部版本号都会同步并更新.

Do this for all your targets and their build numbers will all be synced and updated every time you run any of the targets.

从此处获得此答案: https://stackoverflow.com/a/58237340/1432355

P.S .:如下面的评论所述

在运行脚本"阶段使用avgtool会导致构建被取消

Using avgtool in a Run Script Phase causes the build to get cancelled

原始:

我认为您没有做错任何事情.

You didn't do anything wrong I think.

如果转到info.plist,您将看到内部版本号已由$(CURRENT_PROJECT_VERSION)替换(您可以在构建设置"选项卡中找到该变量).

If you go to your info.plist you will see that the build number has been replaced by $(CURRENT_PROJECT_VERSION) (you can find the variable in the Build Settings tab).

我猜您正在使用一个脚本,该脚本会自动增加内部版本号,并且会导致问题(目前我的项目中有相同的内容).

I am guessing you are using a script that increments build number automatically and that is causing the issue (I have the same thing on my project right now).

如果您删除该脚本,则您的应用应该可以正常编译而不会出现此错误.

If you remove that script your app should build without this error.

我还没有找到有关如何使脚本与此新的$(CURRENT_PROJECT_VERSION)变量一起使用的解决方案. (找到解决方案后,我将更新此答案)

I haven't found a solution yet on how to make the script work with this new $(CURRENT_PROJECT_VERSION) variable. (I will update this answer when I have found the solution)

这篇关于Xcode 11存档使PhaseScriptExecution失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆