Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Cocoapods one target multiple platforms

I want to try to get Firebase SDK working for both iOS and macOS app using the new Apple Catalyst project (porting iOS app to macOS).

I've already setup my Xcode project with Cocoapods and it's working fine using this pod file:

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

However, how do I add so that it builds for macOS as well using the same target (xxxxx-app in pod file).

like image 226
Sunkas Avatar asked Jun 04 '19 19:06

Sunkas


1 Answers

Developing Firebase with Catalyst

Install Catalina and Xcode 11.

For each podspec in https://github.com/firebase/firebase-ios-sdk, run

  • pod gen {name here}.podspec --local-sources=./ --auto-open
  • Check the Mac box in the App-iOS Build Settings
  • Sign the App in the Settings Signing & Capabilities tab
  • Click Pods in the Project Manager
  • Add Signing to the iOS host app and unit test targets
  • Select the Unit-unit scheme
  • Run it to build and test

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

like image 123
Filippo Zanfini Avatar answered Sep 22 '22 11:09

Filippo Zanfini