将应用程序移植到 Mac 终于成为可能,这要归功于Catalyst问题是,许多 pod 不支持 AppKit。
最常见的是 Crashlytics / Firebase。
In [...]/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(CLSInternalReport.o), building for Mac Catalyst, but linking in object file built for iOS Simulator, file '[...]/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics' for architecture x86_64
由于这是最近的话题,我无法查找有关如何从 macOS 版本中删除 pod 并保留 iOS 和 iPadO 版本的文档S.
可以在代码中使用:
#if !targetEnvironment(macCatalyst)
// Code to exclude for your macOS app
#endif
但这是问题的一部分,另一部分是仅链接 iOS 的 pod...
当该库对于 macOS 来说并不重要但在 iOS 上仍然需要时,最简单/最好的行动方案是什么?
对于处理 Catalyst 不受支持的框架的最佳方法,你们应该阅读以下解决方案费尔南多·莫亚·德·里瓦斯 https://medium.com/better-programming/macos-catalyst-debugging-problems-using-catalyst-and-cocoapods-579679150fa9,他有一个 github 并提供了解决方案here https://github.com/fermoya/CatalystPodSupport有更多最新信息。
他基本上说你只需要定义一个你不想在 mac osx 上安装的所有库的数组,如下所示:['Fabric', 'Crashlytics', 'Firebase/Core', ...]
.
然后,你的 pod 文件看起来很简单,如下所示:
# Podfile
load 'remove_unsupported_libraries.rb'
target 'My target' do
use_frameworks!
# Install your pods
pod ...
end
# define unsupported pods
def catalyst_unsupported_pods
['Fabric', 'Crashlytics', 'Firebase/Core', ...]
end
# Remove unsupported pods from your project
post_install do |installer|
installer.configure_support_catalyst
end
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)