ios - 使用催化剂移植到 mac 时排除 pod
问题描述
多亏了Catalyst,终于可以将应用程序移植到 mac,但问题是,许多 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 处理不受支持的框架的最佳方法,你们应该阅读Fernando Moya de Rivas的解决方案,他有一个 github,这里有一个包含更多最新信息的解决方案。
他基本上说你只需要定义一个你不想在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
推荐阅读
- r - 是否有 ggplot2 类似于 R 中的 avPlots 函数?
- c# - 在低带宽的离线卫星环境中,服务器到服务器数据传输的最佳方式是什么
- ios - 动态链接对象没有 url
- javascript - 让事件多次运行,Highcharts
- python-3.x - 在 wxPython 中使用 sizer 并添加一个小部件时,如果将 -1 设置为比例,这意味着什么?
- selenium - 使用 Selenium Web 驱动程序,无法截取带有工具提示文本的网页截图
- angularjs - 在 AngularJS -$http.get 错误:$http.get() 不是函数
- c++ - C++ PyImport 的 Python 覆盖率
- angular - 使用组件作为 NPM 包 Angular6
- typescript - 打字稿在执行算术运算时发誓字符串的类型