我正在现有应用程序上实现一个非常基本的任务(从远程服务器下载一些文件),以练习新的 Swift Concurrency 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
Run Code Online (Sandbox Code Playgroud)
环境:Xcode 13.0 beta 2 (13A5155e) 模拟器 iPhone 8 (iOS 13.5)。Swift 语言版本 5
我能做点什么吗?
编辑:这就是我使用 if available 的方式
@available(iOS 15.0, *)
class SCTestViewController: UIViewController {...}
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建我的库,但是一个名为 evutil.c fom libevent 的文件给我带来了困难。
libevent/evutil.c: error: implicit declaration of function 'pipe2' is invalid in C99
涉及的代码是:
if (pipe2(fd, O_NONBLOCK|O_CLOEXEC) == 0)
return 0;
Run Code Online (Sandbox Code Playgroud)
我现在无法将代码更新为 c11。我应该如何更改代码以不再出现此错误?