我正在现有应用程序上实现一项非常基本的任务(从远程服务器下载少量文件),以练习新的 Swift 并发 API。该任务在 iOS 15 上完美完成:我使用任务组并按预期接收图像。由于这个应用程序已经存在,我使用@available 标签来检查设备是否可以执行我的任务(如果是 iOS 15,请执行此操作。否则,向用户显示警报并且什么都不做)当我尝试运行此问题时会发生问题使用 iOS 13.5 的模拟器上的应用程序,我的应用程序在启动时崩溃并出现以下错误:
dyld: Library not loaded: /usr/lib/swift/libswift_Concurrency.dylib
Referenced from: /Users/username/Library/Developer/CoreSimulator/Devices/B316A0F0-B7EF-4F5E-8A26-F7FF54E8A681/data/Containers/Bundle/Application/6CF3D46E-3F15-4FA3-BD61-9D353541B9DA/MyApp.app/MyApp
Reason: image not found
dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/username/Library/Developer/CoreSimulator/Caches/dyld/20F71/com.apple.CoreSimulator.SimRuntime.iOS-13-5.17F61
DYLD_ROOT_PATH=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot
DYLD_LIBRARY_PATH=/Users/username/Library/Developer/Xcode/DerivedData/MyApp-bawyiebpygwuwxawcoistefwxuyy/Build/Products/Debug-iphonesimulator:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDI
环境:Xcode 13.0 beta 2 (13A5155e) 模拟器 iPhone 8 (iOS 13.5)。Swift 语言版本 5
有什么我可以做的吗?
编辑:这就是我使用的方式(如果可用)
@available(iOS 15.0, *)
class SCTestViewController: UIViewController {...}