Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Failed to load Analytics native module" error with using iOS manually #19

Closed
vladTrex opened this issue Nov 19, 2018 · 7 comments
Closed

Comments

@vladTrex
Copy link

Hi there!

We tried to install segment through manually install (don't use CocoaPods), passed all steps described in readme and build was launched.

But when I try to import analytics lib import analytics from '@segment/analytics-react-native';
I got an error: Failed to load Analytics native module'
Error was reproduced on 2 environments.

I also checked integration in xcode:

  • Embedded Binaries (added Analytics.framework)
  • Embed Frameworks
    Versions: RN 0.55, analytics-ios SDK 3.7.0-beta.2
@vladTrex vladTrex changed the title Can't integrate to iOS (manually) Troubles with integration in iOS (manually) Nov 19, 2018
@ravirupareliya
Copy link

@vladTrex Did you get any solution? I am having same error with ios

@fathyb fathyb changed the title Troubles with integration in iOS (manually) "Failed to load Analytics native module" error with using iOS manually Dec 5, 2018
@fathyb
Copy link
Contributor

fathyb commented Dec 12, 2018

Hey! We've improved support for users using iOS manually in 0.0.1-beta.3, could you try it out? Be sure to follow the migrations instructions. Feel free to reopen if you're still experiencing the issue.

@ryanm2000
Copy link

@fathyb Issue doesn't seem to be fixed in 0.0.1-beta.3.

Here are the steps I took:

  • Remove Analytics.framework from your Xcode project
  • Remove Analytics.framework from Embedded Binaries
  • Add analytics-ios as a npm dependency: yarn add @segment/analytics-ios@github:segmentio/analytics-ios#3.6.10
  • In Finder, open node_modules/@segment/react-ios folder, unzip Analytics.Framework.zip
  • In the General tab for your project, search for Embedded Binaries, click add and navigate to newly unzipped folder Carthage/Build/iOS and add Analytics.framework
  • Select 'Copy items if needed' and 'Create groups', click Finish
  • Build project (build succeeds)
  • View Simulator

Expected Behavior:
App launches with no errors

Actual Behavior:
App launches with error: 'Failed to load Analytics module.'

@jjingrong
Copy link

Just in case anyone is still having this error (Aka. Failed to load Analytics native module), and you weren't trying to do it manually -

You will have to run

pod install

inside your /ios folder in your React Native project, then compile it through xcode.

@mickmak-busicat
Copy link

I just fixed this problem by doing:

  1. Add ${PROJ_DIR}/node_modules/@segment/analytics-react-native/ios/RNAnalytics.xcodeproj to your project Libraries folder group.
  2. Under the project General tab, Linked Frameworks and Libraries section, search for libRNAnalytics.a and add it.
  3. Try to build again and run the app.

This is common react native module manually linking process which I have missed out.
Not sure if it is the case, but worth a try if the library is not added.

@AmitPandya007
Copy link

I just fixed this problem by doing:

  1. Add ${PROJ_DIR}/node_modules/@segment/analytics-react-native/ios/RNAnalytics.xcodeproj to your project Libraries folder group.
  2. Under the project General tab, Linked Frameworks and Libraries section, search for libRNAnalytics.a and add it.
  3. Try to build again and run the app.

This is common react native module manually linking process which I have missed out.
Not sure if it is the case, but worth a try if the library is not added.

this solution did not helped out, will you please suggest some different solution.

@gavrilin-remote
Copy link

gavrilin-remote commented Sep 2, 2019

I just fixed this problem by doing:

  1. Add ${PROJ_DIR}/node_modules/@segment/analytics-react-native/ios/RNAnalytics.xcodeproj to your project Libraries folder group.
  2. Under the project General tab, Linked Frameworks and Libraries section, search for libRNAnalytics.a and add it.
  3. Try to build again and run the app.

This is common react native module manually linking process which I have missed out.
Not sure if it is the case, but worth a try if the library is not added.

Works for me, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants