analytics-react-native: 'Analytics/SEGAnalytics.h' file not found

When following the React Native install instructions, I get a error

'Analytics/SEGAnalytics.h' file not found

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

ok, so some further updates on this: a better way is simply to add the analytics-ios lib next to the analytics-react-native one.

I have this in my package.json:

    "@segment/analytics-ios": "github:segmentio/analytics-ios#efb4cd1771dab568422473fd680ffb748b102f07",

and then I dragged & drop the node_modules/@segment/analytics-ios/Analytics.xcodeproj project next to the RNAnalytics one

capture d ecran 2018-12-04 a 19 56 59

and then, you don’t need to have the hardcoded .framework in your project anymore because analytics-ios lib will actually make it as a target. you just need to make sure that Analytics.framework is in Embedded Binaries.

BTW, I recommend to do this instead of what the current README point to (the github releases binaries) because these binaries actually don’t work with XCode 10, you will have bad surprise when you try to Archive your app and send to Testflight.

hope this helps

@fathyb the problem is the Framework Search Paths. this fixes the problem:

  • add Analytics.framework to RNAnalytics’s Building Settings : into Framework Search Paths your put $(SRCROOT)/../../../../ios
  • then in RNAnalytics’s Build Phases you add a Copy Files phase where you put Analytics.framework (basically you can drag and drop the one under RNAnalytics/Frameworks on Xcode) and make sure you have selected “Frameworks” in Destination and clear the Subpath field.
  • ( optionally you can add Analytics.framework under Link Binary With Binaries of RNAnalytics )

thx to @KhalilBellakrid

Sorry for the confusion @caroaguilar! We’ve improved support for users using iOS manually and added E2E tests in 0.0.1-beta.3, could you try it out? It’s based on @gre’s comment (thanks for that!). Be sure to follow the migrations instructions.

Please let us know if you’re still experiencing any issues.

@AmitPandya007 well you should try, it’s working for me using Cocoapods. You can use the React Native upgrade helper and follow the steps for Segment docs https://github.com/segmentio/analytics-react-native#installation

Thanks a lot for your time and reply.

For anyone wondering the fix above also works for Carthage (which is lot closer to a manual install than the automatic install CocoaPods offers)

@gre 's Second comment fixed the issue for me minus the first part about including the package in my package.json, since Carthage already fetches the Analytics project. I just had to drag the Analytics.xcodeproj from my Carthage/Checkouts/analytics-ios/ directory into XCode Libraries at the same level as RNAnalytics.xcodeproj

Cheers!

I am getting error when adding the GitHub ref to the package: npm ERR! premature close? I am also not upgrading, this if just from installing the beta3 fresh.

I have tried to use the CocoaPods way as well, and it does not build either.

@gre’s second solution worked, thanks

This is happening to me too. I’m not using Cocoapods, I followed the steps to add segment manually. screen shot 2018-11-06 at 11 37 40 am