$ gem install cocoapods-catalyst-support
Note: If you're using cocoapods
action from fastlane
, make sure to include gem 'cocoapods-catalyst-support'
into your Gemfile
. Don't forget to run bundle install
after. For reference, see the Sample project.
These are the steps to follow:
pod catalyst init
in your project folder.ios
or macos
to make them available in one platform or the other:
catalyst_configuration do
ios 'Firebase/Analytics' # This dependency will only be available for iOS
macos 'AppCenter/Analytics' # This dependency will only be available for macOS
end
pod catalyst validate
to validate your configurationpod catalyst run
and configure your catalyst dependenciesThat's it! Simple as that.
Note: Make sure to read the Disclaimer section to understand what this library does and what it doesn't.
Command | Description |
---|---|
pod catalyst |
Short version of pod catalyst run |
pod catalyst init |
Set up your Podfile to use cocoapods-catalyst-support |
pod catalyst run |
Configure your catalyst dependencies |
pod catalyst validate |
Validate your catalyst configuration |
Note: Make sure to run this commands in your project folder.
If you're using CocoaPods and your App supports macCatalyst, you might have run into this error:
ld: 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
clang: error: linker command failed with exit code 1 (use -v to see invocation)
or maybe
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_UIWebView", referenced from:
objc-class-ref in BNCDeviceInfo.o
objc-class-ref in BranchViewHandler.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Perhaps the error came from the App Store:
ERROR ITMS-90276: "Missing Bundle Identifier. The application bundle contains a tool or framework ${PRODUCT_NAME} [com.myapp.myapp.pkg/Payload/MyApp.app/Contents/Resources/GoogleSignIn.bundle] that is missing the bundle identifier in its Info.plist file."
This library is meant to solve this issue so that your project compiles as usual before supporting macCatalyst. Thus, you won't need to modify your current project structure.
Additionally, you might be thinking of using some libraries only for macCatalyst. This library takes care of that too and lets you configure which libraries will be linked for macOS and which for iOS.
It doesn't "magically" fix the pod. If the pod isn't built for sdk MacOS
, then there's nothing that will make it compile for this architecture but the pod's author supporting macCatalyst.
It configures your pods project so that these "unsupported pods" are not linked when building for macOS and will strip those frameworks from the final Product. You'll still need to use the precompiler to remove features from your macCatalyst App:
#if canImport(ToInclude)
// import iOS dependency
#endif
or
#if !targetEnvironment(macCatalyst)
// code to be excluded at compilation time from your macOS app
#endif
If you're using Objective-C
:
#if __has_include(<ToExclude/ToExclude.h>)
// import iOS dependency
#endif
or
#if !TARGET_OS_MACCATALYST
// code to be excluded at compilation time from your macOS app
#endif
The advantage is you still get to use them for iOS and iPadOS.
require 'cocoapods-catalyst-support'
platform :ios, '12.0'
use_frameworks!
target 'Sample' do
pod 'AppCenter/Analytics'
pod 'Firebase/Analytics'
end
catalyst_configuration do
verbose!
ios 'Firebase/Analytics'
macos 'AppCenter/Analytics'
end
post_install do |installer|
installer.configure_catalyst
end
verbose!
to your catalyst_configuration
and check if the library is being excluded.catalyst_configuration
by running pod catalyst validate
.cocoapods-catalyst-support
versionIf you love this script, understand all the effort it takes to maintain it and would like to support me, you can buy me a coffee by following this link:
You can also sponsor me by hitting the GitHub Sponsor button. All help is very much appreciated.
cocoapods-catalyst-support
is available under the MIT license. See the LICENSE file for more info.