Recently, I updated Xcode 12 for a project that required idFA and iOS 14 was not able to obtain IDFA as before. As a result, I encountered some annoying problems again. Here are some of the ways to get stuck.

Xcode 12 emulator compilation error

Error: The project cannot run on the emulator after upgrade.
building for iOS Simulator, but linking in object file built for iOS, xxxx for architecture arm64
Copy the code

or

library not found for -lAFNetworking
Copy the code

or

or

X86_64 is supported by default in Xcode11, but apple released ARM Mac in Xcode12, which makes Xcode for ARM consoles not need x86_64 support by default. X86_64 is not added by default. You need to add it manually to run the emulator on the Mac.

Solution:

Before the error message Xcode 12 is displayed, we use Valid Architectures to configure the supported models.

But in Xcode12, the Valid Architectures entry is removed and changed to the VALID_ARCHS column.

We need to add emulator models for x86_64 on the VALID_ARCHS as shown below:

IOS14 emulator crashes due to CoreNFC framework as follows:

dyld: Library not loaded: /usr/lib/libnfshared.dylib Referenced from: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes /iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreNFC.framework/CoreNFC Reason: no suitable image found. Did find: /usr/lib/libnfshared.dylib: mach-o, but not built for platform iOS-sim dyld: launch, loading dependent libraries DYLD_SHARED_CACHE_DIR=/Users/plz/Library/Developer/CoreSimulator/Caches/dyld/19G2021/com.apple.CoreSimulator.SimRuntime. IOS - 14-0.18 A372 DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Pr ofiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/plz/Library/Developer/Xcode/DerivedData/HGSmallSpace-aoaicklezglbuvgbuqnbqchibvuq/Build/Product s/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSim ulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_PRINT_STATISTICS=1 DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimul ator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/X code.app/Contents/Developer/Platforms/iPhoneOS.platform/LibCopy the code
Previously, our application used CoreNFC to scan NFC labels, or if NFC is not supported, scan codes.
It also runs well in the simulator. upgrade
After Xcode12,
In iOS13 (or lower), you won’t have any problems running on an emulator.
However, the above error occurred when Xcode12 was running on iOS14 emulator iPhone11.

Remove any references to the CoreNFC framework by commenting out the code section and removing the frame link, and the crash disappears. Analysis of the iOS 14 emulator issue should be fixed with the next release of Xcode.

The solution

Copy the missing libnfshared from Xcode 12 Beta 6 until Apple fixes the problem. The missing libnfshared can be found in this directory:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes /iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/Copy the code

Recommended reference: Developer forums