Search code examples
iosobjective-creact-nativecocoapodsmixpanel

Module 'Mixpanel' not found. mixpanel-iphone


Integration Method: CocoaPods Xcode Version: 12.1 Library Version: 3.6.3 Platform: iOS Language: Objective-C Description: Issue when integrating Mixpanel Notification Service, Module Mixpanel not found in NotificationService.h Expected Behavior: For the Notification Service target to work properly following Mixpanel documentation.

I followed the steps in Mixpanel/Mixpanel-iphone Readme. Because the website documentation has a typo for Rich Push Notifications NotificationService.h being repeated should a one .m file.

I followed everystep well, installed the pods but I couldn't run no matter what. Because we use Flipper the usage of use_frameworks! gives us some issues. I have tried use_frameworks! :linkage => :static instead and some workaround to make use_frameworks! works. I tried changing Require only App-Extension-Safe Api to No, adding Mixpanel path to Podfile, adding paths to Notification target build settings all didn't work and I get Module 'Mixpanel' not found in NotificationService.h

I also tried starting everything over as I thought maybe my project got corrupted. I see Mixpanel being installed with pods but I cannot import it from NotificationService.h

Here the end of my podfile:

target 'NotificationService' do
  pod 'Mixpanel'
end

Here is my NotificationService.h file:

@import Mixpanel;

@interface NotificationService : MPNotificationServiceExtension

@end

Is there any solution to make this work? Thank you.


Solution

  • if you don't have use_frameworks enabled in Podfile for both host and extension targets. Then you can import the header file in your NotificationService Extension as shown below to work around this module not found compiler error.

    FYI; I was able to import the module just by including use_frameworks option in pod file.

    enter image description here