Xcode 12构建目标顺序错误? [英] Xcode 12 build target in wrong order?

查看:251
本文介绍了Xcode 12构建目标顺序错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目在Xcode 11中一直运行良好,但是在安装Xcode 12 beta4之后,它将为模拟器构建失败。

My project alway work well in Xcode 11 for years, but after i install Xcode 12 beta4, it will build fail for simulator.

然后比较Xcode 11和Xcode 12,似乎在Xcode 12中,我的主要目标将在构建cocoapods目标之前进行构建,因此链接将失败,因为找不到cocoapods库。

and i compare the build logs in Xcode 11 and Xcode 12, it seems in Xcode 12, My main target will be build before the cocoapods target being build, so the link will failed because the cocoapods library will not be found.

如何修复

在Xcode 11中,一切都很好。 我自己的目标是在可可足目标之后建立的。

In Xcode 11, everything is fine. My own target is build after the cocoapods target .

在Xcode 12中,构建顺序不正确我自己的目标是在cocoapods目标之前构建的。

In Xcode 12, the build order is out of order My own target is build before the cocoapods target .

推荐答案

好的,我有一个使构建工作生效的解决方案(这种解决问题的方法不正确,在我的更新中添加了正确的修复方法)

OK, i got a solution to make the build work (this way to fix problem is not correct , the right way to fix is added in my update):

1,您需要将Pods项目作为外部项目添加到主项目中

2在您的主项目的构建阶段中显式添加所有cocodpods目标作为依赖项

但是我仍然认为可能是xcode 12的新测试版解决这个问题。因为它似乎是xcode 12的错误(我的项目在xcode 11和xcode 12 + ios设备上完美运行,仅在xcode 12 +模拟器上失败)

But i still think may be the new beta version of xcode 12 will fix this. because it seem a bug of xcode 12 (my project work perfect in xcode 11 and xcode 12 + ios device , failed in xcode 12 + simulator only)

# ## 2020-08-17 update ###

###2020-08-17 update###

我发现了重现此问题的确切原因,看来我在xcode 12中打开的项目文件会自动生成VALID_ARCHS 用户定义中的宏,该宏将使构建失败

然后我发现,有了这个宏,在建筑物的LINK中,链接目标类型将是未知类型
' arm64-apple-ios11.0-simulator '
会导致构建失败,并且所有目标似乎都以错误的顺序构建的问题只会在添加此宏后才会发生

And i found that ,with this macro , During in the LINK of building,the link target type will be a unknown type 'arm64-apple-ios11.0-simulator' which cause the build faild and the problem that all the targets build in wrong order seems will only happen when this macro is being added

XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios11.0-simulator 

我删除此VALID_ARCHS宏后,链接目标类型为' x86_64-apple-ios11.0 -simulator ,一切顺利

after i delete this VALID_ARCHS macro, the link target type will be 'x86_64-apple-ios11.0-simulator' , and everything goes well

XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios11.0-simulator 

#### 2020-09-11 add添加有关此宏的Apple反馈####

####2020-09-11 add Add Apple's Feedback about this macro####


  • 在查看您的反馈后,我们还会为您提供一些附加信息

  • After reviewing your feedback, we have some additional information for you:

Xcode不会将VALID_ARCHS添加到您的项目中。实际上,我们建议
反对使用VALID_ARCHS。也许由于某些原因某些CocoaPod在您的
项目中设置了它? CocoaPods不是Xcode的一部分,因此,我们对
的操作没有任何控制。

Xcode does not add VALID_ARCHS to your project. Indeed, we recommend against using VALID_ARCHS. Maybe some CocoaPod is setting it in your project for some reason? CocoaPods are not part of Xcode so, we don’t have any control over what they do.

要注意的一点是,在Xcode 11中,VALID_ARCHS显示在$下b $ b体系结构部分。由于我们强烈建议您不要使用
,因此不再显示它,并且如果已定义,则现在显示在用户
已定义部分。

One thing to note is that in Xcode 11 VALID_ARCHS showed up under the architectures section. Since we are strongly recommending against using it, it no longer shows up there and now appears in the User Defined section if it is defined at all.

Xcode 11用于自动将
模拟器的arm64构建转换为x86_64的构建,但现在arm64是有效的
模拟器体系结构(这是Apple Silicon体系结构),则不再进行
翻译。

Xcode 11 used to automatically translate building for arm64 for the simulator into building for x86_64, but now that arm64 is a valid simulator architecture (it’s the Apple Silicon architecture), that translation no longer occurs.

因此,我们怀疑您应该从$ b $中删除VALID_ARCHS b项目,并确保将Architectures(ARCHS)设置为
Standard Architectures(ARCHS_STANDARD)而不是特定于
的东西(除非您真的很清楚为什么不使用ARCHS_STANDARD)。

So, we suspect what you should do is delete VALID_ARCHS from your project altogether, and make sure Architectures (ARCHS) is set to Standard Architectures (ARCHS_STANDARD) and not to something specific (unless you really know exactly why you’re not using ARCHS_STANDARD).

这篇关于Xcode 12构建目标顺序错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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