在 watchOS 5.2 崩溃中找不到适合 Combine 的映像



信息

我的应用程序在运行watchOS 4和5的Apple Watch上崩溃。一些新功能(即Combine),依赖于watchOS 6,并且这些方法的使用明确标有

@available(watchOSApplicationExtension 6.0.0, *)

该应用程序是用Xcode 9/10创建的(我忘记了确切的哪个),并且针对watchOS 4。现在,当它使用 Xcode 11 构建并具有依赖于 Combine 的文件时,它会在 watchOS 5 Apple Watch 上崩溃。

错误是

dyld: Library not loaded: /System/Library/Frameworks/Combine.framework/Combine
Referenced from: /private/var/containers/Bundle/Application/7A361FAB-EBE7-483D-BFD7-E915F15B5B14/Chirp WatchKit App.app/PlugIns/Chirp WatchKit Extension.appex/Chirp WatchKit Extension
Reason: image not found

显然,Combine,玩得并不好。

此外,它不会在watchOS 5模拟器中启动,并且错误更能说明问题:

dyld: Library not loaded: /System/Library/Frameworks/Combine.framework/Combine
Referenced from: /Users/willbishop/Library/Developer/CoreSimulator/Devices/C6F36860-E70A-45E6-AC3B-E54DBCEA7C7A/data/Containers/Bundle/Application/1B2EC7C4-731F-4EC1-B23F-09A0B49CD055/Chirp WatchKit App.app/PlugIns/Chirp WatchKit Extension.appex/Chirp WatchKit Extension
Reason: no suitable image found.  Did find:
/System/Library/Frameworks/Combine.framework/Combine: mach-o, but wrong architecture

我尝试过什么:

  • 我认为这可能是因为我有watchOS 6依赖代码,与watchOS 5文件混合在一起。但是,将代码移动到单独的文件中后,问题仍然存在。

  • 清理项目

  • 删除Derived Data/

尽管如此,没有运气。我认为这是某个地方的构建设置,但我对哪一个没有最微弱的线索。

我相信你需要做的是使Combine.framework可选链接。出于某种原因,Combine 无法为此使用正常的 UI(还?),但似乎在另一个线程中有一个解决方案。

最新更新