在react native中,版本0.73.4,新建一个react native的工程,可以发现最低的iOS适配版本是13.4,如果切换成以下的其他版本,那么就会报错。
dyld: Symbol not found: OBJC_CLASS$_NSUnitInformationStorage
Referenced from: /Users/hanweixing/Library/Developer/CoreSimulator/Devices/6FB156D2-56AE-4192-8B39-50307DFC11FC/data/Containers/Bundle/Application/D25E91AA-D245-484B-9197-9D328AAAF4A7/ShuYuanVer.app/Frameworks/hermes.framework/hermes (which was built for iOS 13.4)
Expected in: /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 12.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation
in /Users/hanweixing/Library/Developer/CoreSimulator/Devices/6FB156D2-56AE-4192-8B39-50307DFC11FC/data/Containers/Bundle/Application/D25E91AA-D245-484B-9197-9D328AAAF4A7/ShuYuanVer.app/Frameworks/hermes.framework/hermes
dyld: launch, loading dependent libraries
DYLD_FRAMEWORK_PATH=/Users/hanweixing/Library/Developer/Xcode/DerivedData/ShuYuanVer-cjidiiifatjytufqpysibozvnmcc/Build/Products/Debug-iphonesimulator
DYLD_FALLBACK_LIBRARY_PATH=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 12.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib
DYLD_ROOT_PATH=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 12.4.simruntime/Contents/Resources/RuntimeRoot
DYLD_FALLBACK_FRAMEWORK_PATH=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 12.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks
DYLD_INSERT_LIBRARIES=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 12.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 12.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 12.4.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/Pr
...
截图:
除此之外,有一个实验性的更新hermes的问题,这里提一下。
如果你的react-native工程不是最新稳定版本,按照官方的建议,是不再支持not active version的修复和issue回答的,所以尽量安装最新的稳定版本。
另外,当你遇到hermes的 dyld library not loaded hermes.xcframework
这样的错误时,如果你正好升级到最新版本,但是升级后报了hermes的这样的错误,你可以尝试升级hermes:
pod update hermes-engine --no-repo-update
这样可能会解决你遇到的问题。