Car*_*rgo 6 xcode ios swift xcode13
我正在现有应用程序上实现一个非常基本的任务(从远程服务器下载一些文件),以练习新的 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)
我也有同样的问题Xcode 13.2.1
这Xcode 13.3也可能导致您的新构建被拒绝Async/await causes apps not process for AppStore。
解决方法1
\n最简单的解决方法是更新到Xcode 13.3.1支持Swift 5.6.
\n\nXcode 13.3 Beta 发行说明:
\n已解决的问题 在 macOS 10.15、iOS 13、tvOS 13 或 watchOS 6 之前的操作系统上使用反向部署的 Swift Concurrency 的应用程序\n不再在启动时崩溃。(87789769)
\nXcode 13.3.1 发行说明:
\n已解决的问题
\n已修复:当应用程序面向 iOS 13.0\xe2\x80\x9314.7、\nwatchOS 6.0\xe2\x80\x937.6 时,从具有位码的存档导出使用 Swift\xe2\x80\x99s 并发功能的应用程序可能会失败,或 tvOS 13.0\xe2\x80\x9314.7。(89271047) 当您以 iOS\n13.4 及更高版本为目标并启用位码时,现在可以正确剥离位码段。这修复了导致某些应用程序无法在旧操作系统(iOS 14 及更早版本)中运行的崩溃问题。(90024354) (FB9951126)
\n
本期的一些链接Alamofire GRDB.swift RxSwift
\n解决方法2
\n有很多库可能会导致此失败。\n因此,如果您不想更新,Xcode只需降级某些库即可。例如:
RxSwift至6.2或更低;Alamofire至5.4.4或更低;GRDB至5.16.0或更低;大多数导致失败的库都有这样的问题。github因此,您可以使用文本搜索这些问题libswift_Concurrency.dylib。他们中的大多数人都说它已修复Xcode 13.3.1。
根据 @vera-gonzalez 对她的案例所做的事情找到了一个解决方案。\n这不是生产代码。\n我还从 swift 快照 https://swift.org/download/#snapshots 下载了 PKG 文件,我得到了两个版本(iphoneos 和 iphonesimulator)来自/Library/Developer/toolchains/<snapshotname>/usr/lib/swift/<version>/libswift_Concurrency.dylib
之后我用 lipo 创建了一个 fat dylib 文件:
\n\xe2\x9d\xaf lipo iphoneos/libswift_Concurrency.dylib iphonesimulator/libswift_Concurrency.dylib -create -output libswift_Concurrency.dylib\n\xe2\x9d\xaf lipo -info libswift_Concurrency.dylib\nArchitectures in the fat file: libswift_Concurrency.dylib are: armv7 armv7s i386 x86_64 arm64 arm64e\nRun Code Online (Sandbox Code Playgroud)\n之后,我将此 dylib 文件作为可选库添加到我的项目中,位于我的项目的目标上。\n
有了这个技巧,我现在可以在我的项目上为设备和模拟器构建、运行和存档(Swift 论坛上的讨论表明这个问题将在某个时候得到修复,但同时,我们可以用它来测试我们的应用程序)
\n| 归档时间: |
|
| 查看次数: |
10243 次 |
| 最近记录: |