Code Monkey home page Code Monkey logo

catalystpodsupport's Introduction

CatalystPodSupport

Requirements

Who's this for?

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 script are meant to solve this issue so that your project compiles as usual before supporting macCatalyst.

What does this script NOT DO?

It doesn't "magically" fix the pod. If the pod isn't compiled for x86_64, then there's nothing that will make it compile for this architecture but the pod's author supporting macCatalyst.

What does this script DO?

It configures your pods project so that these "unsupported pods" are not linked or compiled when building for macOS. You'll still need to use the precompiler and remove features from your macCatalyst App:

#if !targetEnvironment(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.

How can I use it?

These are the steps to follow:

  • Identify which pods don't compile for macOS architectures
  • Download this ruby file and place it in the same folder as your Podfile.
  • Modify your Podfile like:
# Inside your Podfile

# 1. Load the file
load 'remove_ios_only_frameworks.rb'

######  YOUR TARGETS  ######

target 'My target' do   
  use_frameworks!   
  # Install your pods   
  pod 'FBSDKCoreKit'
  pod 'Crashlytics' 
  ...
end

# 2. Define which libraries should be configured
def catalyst_unsupported_pods
  [
    "Crashlytics", "Fabric", "Firebase/Analytics"
    "Branch", "FBSDKCoreKit", "ZendeskChatSDK",
    ... # more libraries
  ]
end

post_install do |installer|   
  installer.configure_support_catalyst
end

NOTE: You should use the name catalyst_unsupported_pods as the script expects this keyword.

Customization

Select build configurations to process for Store upload

By default, the script will uninstall resources and frameworks not compiled for x86_64 in all build configurations that have DEBUG=1 in the preprocessor macros, a.k.a. GCC_PREPROCESSOR_DEFINITIONS. This will prevent errors from the App Store. It basically skips embedding resources and frameworks that shouldn't be included in the final archive.

If you use any configuration to debug that doesn't have this macro DEBUG=1 you might run into issues when debugging in simulators. If so, please add this to your Podfile:

def release_build_configurations
  ['Release-Store']
end

This will define the name of those configurations that required this extra process in order to be uploaded to the App Store.

Logs

If you want to see some logging to understand what's happening, add in your Podfile:

def debug
  true
end

catalystpodsupport's People

Contributors

fermoya avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.