简体   繁体   English

Xcode 12:在 FIRAnalyticsConnector 上构建错误

[英]Xcode 12: build Error on FIRAnalyticsConnector

After upgrading to Xcode 12, my project doesn't build for the simulator anymore.升级到 Xcode 12 后,我的项目不再为模拟器构建。

The error I get is:我得到的错误是:

ld: in ... /Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(
FIRAnalyticsConnector_e321ed8e3db06efc9803f6c008e67a34.o), 
building for iOS Simulator, but linking in object file built for iOS, file
'.../Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector'
for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

A workaround is adding arm64 to my project > Build Settings > Excluded Architectures, but then it won't build for my real device.一种解决方法是将arm64添加到我的项目 > 构建设置 > 排除架构中,但它不会为我的真实设备构建。

I already tried cleaning the build folder, updating pod file, restarting etc.我已经尝试过清理构建文件夹、更新 pod 文件、重新启动等。

I'm using:我在用着:

  • Firebase/Analytics (6.33.0) Firebase/分析 (6.33.0)
  • Xcode 12.0.1 (12A7300) Xcode 12.0.1 (12A7300)
  • CocoaPods: 1.9.3 CocoaPods:1.9.3

Any ideas?有任何想法吗?

Ok, I finally found a fix for the issue.好的,我终于找到了解决该问题的方法。

Change "Build Active Architecture Only" to "Yes" also for "Release".对于“发布”,也将“仅构建活动架构”更改为“是”。
The setting can be found selecting your project > "Build Settings" > "Targets" (your target) > "Architectures"可以在选择您的项目>“构建设置”>“目标”(您的目标)>“架构”中找到该设置

需要更改的设置的图像

Source and more elaborate explanation can be found here:来源和更详细的解释可以在这里找到:
https://stackoverflow.com/a/64139830/4134160 https://stackoverflow.com/a/64139830/4134160

Please note that the problem is not related to Firebase.请注意,该问题与 Firebase 无关。 I'll still leave it since it might lead others to this issue and help them to resolve this.我仍然会离开它,因为它可能会导致其他人解决这个问题并帮助他们解决这个问题。

I fixed the issue by running xcode12 under Rosetta (Apple M1).我通过在 Rosetta (Apple M1) 下运行 xcode12 解决了这个问题。

Open Finder -> Application -> locate Xcode -> right click -> get info -> check open using rosetta.打开 Finder -> 应用程序 -> 找到 Xcode -> 右键单击​​ -> 获取信息 -> 使用 rosetta 检查打开。

then reopen xcode.然后重新打开xcode。

After adding arm64 to Excluded Architectures for the main project AND for the Pods project, I was able to resolve this issue I ran into on an Apple M1.arm64添加到主项目和 Pods 项目的Excluded Architectures后,我能够解决我在 Apple M1 上遇到的这个问题。

I also had to clear the DerivedData folder and restart Xcode.我还必须清除DerivedData文件夹并重新启动 Xcode。

For more information, see: https://medium.com/@khushwanttanwar/xcode-12-compilation-errors-while-running-with-ios-14-simulators-5731c91326e9有关更多信息,请参阅: https : //medium.com/@khushwanttanwar/xcode-12-compilation-errors-while-running-with-ios-14-simulators-5731c91326e9

My case was a little different.我的情况有点不同。 According to this Firebase engineer ,根据这位 Firebase 工程师的说法,

FIRAnalyticsConnector is now part of the xcframework version of FirebaseAnalytics and isn't needed to link. FIRAnalyticsConnector现在是 FirebaseAnalytics 的 xcframework 版本的一部分,不需要链接。

Going into the Targets Build Settings (not the Project), searching for Other Linker Flags , and then deleting FIRAnalyticsConnector from the list took care of the issue for me.进入目标Build Settings (不是项目),搜索Other Linker Flags ,然后从列表中删除FIRAnalyticsConnector为我解决了这个问题。

Interestingly, when I ran pod deintegrate and the pod install it did not fix this issue.有趣的是,当我运行pod deintegratepod install它并没有解决这个问题。

Had same problem in Xcode v12.4 after running pod install .运行pod install后在Xcode v12.4同样的问题。

After some searching inside my project I finally found reference to it under target's Build Phases in Link Binary With Libraries section.在我的项目中进行了一些搜索之后,我终于在Link Binary With Libraries部分的目标的Build Phases下找到了对它的引用。 Removing FIRAnalyticsConnector.framework from the list solved my problem.从列表中删除FIRAnalyticsConnector.framework解决了我的问题。

从目标列表中删除 -fraemwork "FIRAnalyticsConnector" -> "build settings" -> OTHER_LDFLAGS

if you run on Apple Silicone with new Macbook Pro M1 processor.如果您在配备新 Macbook Pro M1 处理器的 Apple Silicone 上运行。 This is a known issue.这是一个已知的问题。

Firebase not compiling on Apple Silicone Firebase 未在 Apple Silicone 上编译

that worked.那行得通。 I open Xcode using Rosetta.我使用 Rosetta 打开 Xcode。

Step 1 - Installation第 1 步 - 安装

Homebrew(recommended)自制(推荐)

brew install 417-72KI/tap/xcode-arch

Usage用法

$ xcode-arch -p
arm64 # `Open using Rosetta` is off
$ xcode-arch -c
Set x86_64 for /Applications/Xcode.app
$ xcode-arch -p
x86_64 # `Open using Rosetta` is on
$ xcode-arch -u
Set arm64 for /Applications/Xcode.app
$ xcode-arch -p
arm64 # `Open using Rosetta` is off

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 swift 5 Xcode 12 上的 FirebaseCore 内部错误 - FirebaseCoreInternal error on swift 5 Xcode 12 XCode 错误:找不到构建输入文件:'/Users/anonym/Downloads/GoogleService-Info.plist'” - XCode error: Build input file cannot be found: '/Users/anonym/Downloads/GoogleService-Info.plist'" 无法使用 xcode 方案和配置构建 react-native 应用程序 - Can't build react-native app with xcode scheme and configuration 部署到云运行时出现云构建错误 - Cloud build error when deploying to cloud run 云构建错误:“未知生命周期阶段“/root/.m2”” - Cloud Build Error: "Unknown lifecycle phase "/root/.m2"" Flutter ios 在 Macbook air M2 上构建错误 - Flutter ios build error on Macbook air M2 在 Gridstack 中将列更改为小于 12 - Change column to less then 12 in Gridstack Android Studio 构建错误:Gradle - 找不到平台('com.google.firebase:firebase-bom:30.3.1') - Android Studio build error: Gradle - Could not find platform('com.google.firebase:firebase-bom:30.3.1') 使用云构建部署云功能失败:错误:未能获得 firebase 项目 - deploy cloud functions using cloud build failed: Error: failed to get firebase project 谷歌云容器注册表错误:“无法触发构建:请求包含无效参数。” - google cloud container registry error: "Failed to trigger build: Request contains an invalid argument."
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM