【问题标题】:Using Cocoapods one target multiple platforms使用 Cocoapods 一个针对多个平台
【发布时间】:2019-10-20 08:53:06
【问题描述】:

我想尝试使用新的 Apple Catalyst 项目(将 iOS 应用程序移植到 macOS)让 Firebase SDK 同时适用于 iOS 和 macOS 应用程序。

我已经使用 Cocoapods 设置了我的 Xcode 项目,并且使用这个 pod 文件可以正常工作:

platform :ios, '11.0'

abstract_target 'SharedPods' do
    use_frameworks!
    pod 'Perform'
    pod 'Nuke', '~> 7.6.1'
    pod 'PureLayout'
    pod 'DeviceKit', '~> 2.0'
    pod 'lottie-ios'
    pod 'Highlightr'
    pod 'Firebase/Core'
    pod 'Firebase/Database'
    pod 'Firebase/Auth'
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'GoogleAPIClientForREST/Sheets'
    pod 'GoogleSignIn'
    pod 'SwiftLint'

    target 'xxxxx-app' do
    end

    target 'xxxxx' do
    end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
        config.build_settings['LD_NO_PIE'] = 'NO'
     end
  end
end

但是,我如何添加以便它为 macOS 构建以及使用相同的目标(pod 文件中的 xxxxx-app)。

【问题讨论】:

    标签: ios macos cocoapods


    【解决方案1】:

    使用 Catalyst 开发 Firebase

    安装 Catalina 和 Xcode 11。

    对于https://github.com/firebase/firebase-ios-sdk 中的每个 podspec,运行

    • pod gen {name here}.podspec --local-sources=./ --auto-open
    • 在 App-iOS Build Settings 中勾选 Mac 复选框
    • 在“设置签名和功能”选项卡中为应用程序签名
    • 在项目管理器中单击 Pod
    • 向 iOS 主机应用和单元测试目标添加签名
    • 选择单位单位方案
    • 运行它来构建和测试

    来源:https://github.com/firebase/firebase-ios-sdk/issues/3144#issuecomment-520530306

    【讨论】:

    • 谢谢。但似乎只适用于开源 pod。
    • 非开源 pod 几乎可以肯定是不兼容的,如果不访问代码,就不可能更改它,除非作者进行更改以提供具有 x86-64 兼容性 Catalyst 的非 lipoed 二进制库提供 source 兼容性.. 它不提供二进制兼容性
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-11
    • 1970-01-01
    • 2019-08-16
    • 1970-01-01
    相关资源
    最近更新 更多