ld: library not found for -lAnalytics React Native Segment

Viewed 71

I am trying to use segment for react native. I was able to run, connect and make it all work but when I tried to archive my project, I get this error "ld: library not found for -lAnalytics" I'm not too sure how to go about debugging this. Any ideas?

"@segment/analytics-react-native": "^1.5.0", "@segment/analytics-react-native-mixpanel": "^1.5.0",

1 Answers

In ios/Podile, in your post_install section, try adding:

    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end

It goes where I've put # HERE in this example 0.69 Podfile.

platform :ios, '12.4'

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

# ignore all warnings from all pods
inhibit_all_warnings!

target 'myApp' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  target 'myAppTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    # HERE
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end
end
Related