samzilverberg/cordova-mixpanel-plugin

Ionic 2 - Mixpanel.h not found on iOS

Closed this issue · 10 comments

iOS build failed after adding this plugin.
Steps to reproduce (assuming there is an existing ionic 2 project),

  1. ionic plugin add cordova-plugin-mixpanel
  2. npm install --save @ionic-native/mixpanel
  3. ionic build ios

Build Error
"..........Plugins/cordova-plugin-mixpanel/MixpanelPlugin.h:3:9: fatal error: 'Mixpanel.h' file not found"
mixpanel h_not_found

Ionic Info
Your system information:

Cordova CLI: 7.0.1
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.1.14
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: OS X El Capitan
Node Version: v7.0.0
Xcode version: Xcode 8.2.1 Build version 8C1002

Any idea how to resolve this?

i'd guess you project is missing the mixpanel sdk which is supposed to be installed by pod, or perhaps its installed but not linked/connected correctly in your xcode project.

i suggest that you first checkout troubleshooting section in readme
after you're sure pod has installed the mixpanel code, do your ionic build, then make sure you open the right xcode project file, i believe there should be two of them.

btw what version of plugin are you using?

I was having the same issue, but I was able to solve it by doing this:

  1. Remove the plugin: ionic cordova plugin remove cordova-plugin-mixpanel --save
  2. Add the plugin again: ionic cordova plugin add cordova-plugin-mixpanel --save
  3. And then go to the platform/ios folder and run pod install. In the output, you should see that something related to Mixpanel (Mixpanel-AppExtension (3.1.9)) is being instaled:
Analyzing dependencies
Downloading dependencies
Using GGLInstanceID (1.2.1)
Using GoogleCloudMessaging (1.2.0)
Using GoogleIPhoneUtilities (1.2.1)
Using GoogleInterchangeUtilities (1.2.2)
Using GoogleSymbolUtilities (1.1.2)
Using GoogleUtilities (1.3.2)
Using Mixpanel-AppExtension (3.1.9)     <-------------------
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 7 total pods installed.

@nathan5x did the above help?

@samzilverberg - Unfortunately not. :( After updating pods (pod install), I'm getting a different error.

diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

I tried following this stackoverflow suggestions.
https://stackoverflow.com/questions/17072396/cocoapods-errors-on-project-build

No help indeed. I'm planning to reinstall everything. Let me see if I can fix this today and update this thread. Thanks for getting back to me. :)

@nathan5x works yet?

@nathan5x did you see this from README?

try executing pod install in the platform/ios folder

Hi @samzilverberg - I did follow the instructions in README. Did not help. I decided to update all my npm packages and upgrade my Ionic dependencies to version 3.x. I will try this today and post my results here.
Thanks for the follow up man. Appreciate it ;)

Same problem here, any solution? :(

I resolved this issue by following the steps.

  1. Uninstalled node and npm
  2. Installed node through brew (brew install node)
  3. Updated ionic and ionic cli
  4. ionic cordova platform remove ios && ionic cordova platform add ios
  5. ionic cordova build ios

It seemed to resolve this specific issue, however, am getting another one now.
ld: library not found for -lMixpanel-AppExtension clang: error: linker command failed with exit code 1 (use -v to see invocation)

Here is the environment,
`cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 1.1.4
Cordova Platforms  : android 6.2.3 ios 4.4.0
Ionic Framework    : ionic-angular 2.3.0

System:

ios-deploy : 1.9.1
ios-sim    : 6.0.0
Node       : v8.4.0
npm        : 5.3.0
OS         : OS X El Capitan
Xcode      : Xcode 8.2.1 Build version 8C1002`

Finally the day has come... Fixed it yeaay!
I did a manual setup by following this instruction
https://mixpanel.com/blog/2014/09/30/integrating-the-mixpanel-ios-sdk-without-cocoapods/