我们的应用程序使用CoreNFC扫描NFC标记,如果不支持NFC,也可以使用QR。这是很好的工作,我们能够运行的应用程序在模拟器(ui)测试的目的。
直到Xcode12 / iOS14通用汽车建立。在iOS13 (或更低版本)中,在模拟器上运行它不会有任何问题。
但是,在Xcode12中,在iOS14模拟器iPhone11上运行它,我们可以得到以下信息:
dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/xxx/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/xxx/Library/Developer/Xcode/DerivedData/xxx-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模拟器崩溃对我来说是有意义的,因为模拟器不能扫描NFC标记,但这就是我所做的:
#if canImport(CoreNFC)放在import CoreNFC上,它就是底层的NFC代码。-weak_framework "CoreNFC"添加到其他Linker设置显然,通过注释掉代码部分和删除框架链接来删除对CoreNFC框架的任何引用,就会使崩溃消失。但这不是个合适的选择。
从Xcode12在iOS13模拟器‘设备’上运行它是非常完美的。所以我似乎不知道是什么导致了这种行为
发布于 2020-10-01 06:09:31
苹果显然忘了在iOS 14模拟器Xcode 12的最终版本中添加iOS。在苹果修复之前,一个可行的解决办法是从Xcode 12 beta 6复制缺少的库(从Apple的开发人员下载部分下载beta )。在这里可以找到缺少的lib,并且必须进入同一个目录进行最终的Xcode 12。
这对我有用。
如果您想避免为单个文件下载11.25GBXcode 12.2 beta版的麻烦。我有文件要分享。
您可以执行以下命令下载Xcode包并将其放入Xcode包中:
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希望它能帮上忙
发布于 2020-09-22 09:37:28
苹果显然忘了在iOS 14模拟器Xcode 12的最终版本中添加iOS。在苹果修复之前,一个可行的解决办法是从Xcode 12 beta 6复制缺少的库(从Apple的开发人员下载部分下载beta )。在这里可以找到缺少的库,必须进入相同的目录,以获得最终的Xcode 12:
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib
发布于 2020-09-16 09:28:44
Linker说,libnfshared (mach-o)文件不包括模拟器的二进制文件,这很奇怪,因为它是Apple的核心框架。
使用Xcode 12创建一个新项目,并导入NFC框架。构建它并在模拟器上运行它。如果没有崩溃,那么在这些项目之间比较DYLD的构建设置。
如果这没有帮助,请删除所有模拟器并重新创建新的模拟器。
更新:
这是IOS 14中的漏洞,有人提交了雷达:Openradar.apppot.com/FB8699389 8699389
https://stackoverflow.com/questions/63915728
复制相似问题