Porting apps to mac is finally possible thanks to Catalyst, problem is, numerous pods don't support AppKit. Most common one would be 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
Since it's a recent topic, I couldn't find doc on how to remove a pod from my build for macOS but keep it for iOS and iPadOS.
It is possible to use in code:
#if !targetEnvironment(macCatalyst)
// Code to exclude for your macOS app
#endif
But that one part of the problem, the other part is to link the pod only for iOS...
What would be the easiest/best course of action when the library is not vital for macOS but still wanted on iOS?
For the best approach of handling unsupported framweorks for Catalyst, you guys should read the solution of Fernando Moya de Rivas, he has a github with a solution here with more up to date information.
He basically said you just need to define an array of all of the libs you don't want to install on mac osx, like this: ['Fabric', 'Crashlytics', 'Firebase/Core', ...]
.
Then, your pod file can look simple as this:
# 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