问题
I downloaded Xcode 12.0 beta 5 and I'm trying to build my project, but I received the following error:
<unknown>:0: error: unable to load standard library for target 'arm64-apple-ios9.0'
I tried searching online for solutions, but none of what I found helped me to solve this error. I found this thread on SO but none of the proposed solutions worked for me.
I think it's an error related to simulator. In fact, the project builds correctly with generic device and on a real device.
回答1:
Your error message is quite minimal but shows that you're trying to build for iOS 9.0 - I would check your Build Report in the navigator for a more helpful error message. I have a few hunches about the issue:
- The Xcode 12 Beta 6 Release Notes include new "deprecations" which only support specific iOS Simulator versions:
Deprecations When running in macOS 11, Simulator supports iOS 11.4 or later. (59938106)
However, building for device supports iOS 9 and above:
Deprecations Xcode now supports debugging apps and running tests on iOS devices running iOS 9.0 and above. (59561001)
Worth checking the contents of Contents -> Developer -> Platforms -> iPhoneOS.platform -> DeviceSupport for iOS 9. Make sure you've got simulator device support files in here.
Also if you have previous Xcode betas installed, make sure you set the Command Line Tools again to the latest Xcode beta you want to use (they get deactivated if you install a new version of Xcode).
As mentioned in other answers, remove the
$(VALID_ARCHS)
build setting from your main and CocoaPods targets .Check your Architecture Build Settings are set to
$(ARCHS_STANDARD)
for all targets. It's strange that you are using thearm
architecture - usually simulator builds arex86_64
, hence you need to address any conflicting architecture build settings (are you using Mac Catalyst or the Developer Transition Kit perhaps?).
- Disable these scheme settings (in Edit Scheme in the toolbar), as well as Main Thread Checker. This works as a workaround for many build/runtime bugs in Xcode.
- Also, I would check if you are using the new Build System for your build settings for Pods and app targets. Conflicting settings here could be the issue. From Xcode 12 Beta Release Notes:
The legacy build system is deprecated, and will be removed in a future release. (62742902)
For each of these steps, make sure you clear Derived Data and rebuild. It would also be a good idea to restart Xcode between attempts. If none of the 7 suggestions work then I would recommend you raise a bug ticket on Feedback Assistant. Xcode is going through a lot of rapid improvements in the beta phase, so there is probably going to be some unexpected behaviour.
回答2:
I had this problem too. I couldn't build for the simulator with exactly the same error and also broke my head thinking it was because of CocoaPods, but I was mistaken.
As of Xcode 12 Beta release notes:
"The Build Settings editor no longer includes the Valid Architectures build setting (VALID_ARCHS), and its use is discouraged. Instead, there is a new Excluded Architectures build setting (EXCLUDED_ARCHS). If a project includes VALID_ARCHS, the setting is displayed in the User-Defined section of the Build Settings editor. (15145028)"
I was able to resolve this issue by manually editing the project file (I opened my .xcworkspace with a text editor) and removing all the lines referring to VALID_ARCHS.
After that, I was able to build for the simulator just fine.
回答3:
I do not have a clear fix, but i have had this this with previous versions of Xcode. Some worked sometimes and some worked others. the below links have worked for me on different occasions.
https://github.com/OneSignal/OneSignal-iOS-SDK/issues/636 https://github.com/Alamofire/Alamofire/issues/2612
回答4:
VALID_ARCHS was deprecated in Xcode 12, therefore, just delete the reference from your Project and Targets Build Settings by navigating to:
- YourProject Settings > Build Settings > VALID_ARCHS
- YourProject Settings > TARGETS > YourProject > Build Settings > VALID_ARCHS
- YourProject Settings > TARGETS > UITests > Build Settings > VALID_ARCHS
- YourProject Settings > TARGETS > UnitTests > Build Settings > VALID_ARCHS
Image of what VALID_ARCHS should look like
Highlight row and press "delete" key
来源:https://stackoverflow.com/questions/63342162/cannot-build-project-with-xcode-12-0-beta-5