XCode 12, FIRAnalyticsConnector, Build Error

夙愿已清 提交于 2021-02-18 05:03:49

问题


After upgrading to XCode 12, my project doesn't build for the simulator anymore.

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.

I already tried cleaning the build folder, updating pod file, restarting etc.

I'm using:

  • Firebase/Analytics (6.33.0)
  • XCode 12.0.1 (12A7300)
  • COCOAPODS: 1.9.3

Any ideas?


回答1:


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

Please note that the problem is not related to Firebase. I'll still leave it since it might lead others to this issue and help them to resolve this.




回答2:


My case was a little different. According to this Firebase engineer,

FIRAnalyticsConnector is now part of the xcframework version of FirebaseAnalytics and isn't needed to link.

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.

Interestingly, when I ran pod deintegrate and the pod install it did not fix this issue.




回答3:


After adding "arm64" to Excluded Architectures for the project AND the pods, I was able to resolve this issue I ran into on an Apple M1.

I also had to clear DerivedData and restart XCode.

See: https://medium.com/@khushwanttanwar/xcode-12-compilation-errors-while-running-with-ios-14-simulators-5731c91326e9




回答4:


I fixed the issue by running xcode12 under Rosetta (Apple M1).

Open Finder -> Application -> locate Xcode -> right click -> get info -> check open using rosetta.

then reopen xcode.



来源:https://stackoverflow.com/questions/64171400/xcode-12-firanalyticsconnector-build-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!