IOS开发经验

Xcode12 iOS14模拟器 NFC崩溃解决

2020-10-13  本文已影响0人  风见隼人Akf

崩溃现象

在升级到Xcode12之后,启动项目就崩溃,报错信息如下

dyld`__abort_with_payload:
1602577335028.jpg

在Console里打印了具体日志,发现是项目中用到了NFC模块,但是dyld并未加载NFC模块引起的。日志如下:

dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/***/Library/Developer/CoreSimulator/Caches/dyld/19G73/com.apple.CoreSimulator.SimRuntime.iOS-14-0.18A372
DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
DYLD_LIBRARY_PATH=/Users/***/Library/Developer/Xcode/DerivedData/BeeSafe-awnlestrbvesqqbynrhmluzhbcsc/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSi
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

出现这个问题可能是因为xocde12没有附带nfc的这个功能。

解决方法

终端手动安装一下libnfshared.dylib,如果没有速度,需要开科学上网

sudo curl https://storage.googleapis.com/mobile-simulator-build/libnfshared.dylib -o /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libnfshared.dylib

安装完成之后,重启xcode和模拟器即可解决

上一篇 下一篇

猜你喜欢

热点阅读