ios – Dealing with A number of Targets in CocoaPods Causes libPods to Hyperlink Solely One Goal As an alternative of All Targets


I am managing two targets in my React Native iOS Undertaking and I attempted to handle within the Podfile. Later after doing pod set up, in Xcode’s Construct Phases > Hyperlink Binary With Libraries, solely the Dev goal have its libPods linked, specifically with libPods-MyApp (Dev).a. When i clicked “reveal in mission navigator”, within the Frameworks folder it solely reveals libPods-MyApp (Dev).a and libPods-MyAppTests.a whereas the libPods-MyApp.a or simply libPods.a are lacking, and it causes construct errors on my principal goal.

My Podfile are proven under:

$FirebaseSDKVersion = '8.15.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.0'

pod 'Firebase/Messaging'
pod 'GoogleMaps', '3.9.0'
# pod 'Google-Maps-iOS-Utils'

# Outline find-and-replace perform
def find_and_replace(dir, findstr, replacestr)
  Dir[dir].every do |identify|
      textual content = File.learn(identify)
      change = textual content.gsub(findstr,replacestr)
      changed = textual content.index(replacestr)
      if changed == nil && textual content != change
          places "Repair: " + identify
          File.open(identify, "w") file
          STDOUT.flush
      finish
  finish
  Dir[dir + '*/'].every(&methodology(:find_and_replace))
finish

def shared_pods
  # rn_maps_path="../node_modules/react-native-maps"
  # pod 'react-native-google-maps', :path => rn_maps_path
  # pod 'react-native-maps', :path => '../node_modules/react-native-maps'

  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to allow hermes on iOS, change `false` to `true` after which set up pods
    :hermes_enabled => false
  )

  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
  pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'
  pod 'react-native-blob-util', :path => '../node_modules/react-native-blob-util'
  pod 'RNFS', :path => '../node_modules/react-native-fs'
  # pod 'RNSentry', :path => '../node_modules/@sentry/react-native/RNSentry.podspec'

  # Allows Flipper.
  #
  # Observe that in case you have use_frameworks! enabled, Flipper is not going to work and
  # you must disable the following line.
  # use_flipper!()
  use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })
finish

goal 'MyAppTests' do
  inherit! :full
  # Pods for testing
finish

goal 'MyApp' do
  shared_pods
finish

goal 'MyApp (Dev)' do
  shared_pods
finish

post_install do |installer|
  react_native_post_install(installer)

  # To construct for the simulator on Apple M1
  installer.pods_project.targets.every do |goal|
    goal.build_configurations.every do |config|
      # This may apply these settings on each Pod
      # disables arm64 builds for the simulator
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    finish
  finish

  # Repair for XCode 12.5 & RN 0.64.X - See https://github.com/fb/react-native/points/28405
  find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
  "_initializeModules:(NSArray> *)modules", "_initializeModules:(NSArray *)modules")

  find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
    "RCTBridgeModuleNameForClass(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))")

  # Repair for Flipper-Folly on iOS 14.5
  find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
    "atomic_notify_one(state)", "folly::atomic_notify_one(state)")

  find_and_replace("Pods/Headers/Personal/RCT-Folly/folly/synchronization/DistributedMutex-inl.h",
    "atomic_notify_one(state)", "folly::atomic_notify_one(state)")

  find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
    "atomic_wait_until(&state, earlier | information, deadline)", "folly::atomic_wait_until(&state, earlier | information, deadline)")
finish

I anticipated that libPods-MyApp.a or libPods.a to be current, however at the moment it solely creates libPods-MyApp (Dev).a and libPods-MyAppTests.a.

I am fairly certain there’s one thing unsuitable in my Podfile however i do not know what’s it, so please assist me on stating what went unsuitable in my Podfile config. Thanks.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles