Question

Module 'PurchasesHybridCommon'.h not found (Unity/iOS)

  • 1 December 2022
  • 6 replies
  • 373 views

Badge +1

Added the revenuecat package to unity. No ‘purchases’ objects in scenes yet. Building for iOS and then building from XCode yields this error

 


6 replies

Badge +1

Oh, and the question: have others encountered this? Does it mean I missed something basic in the earlier stages of setup? All help/tips appreciated! Matt

Userlevel 5
Badge +9

What version are you trying to install? Can you try deleting the RevenueCat unitypackage from your project and try importing again? Maybe the ExternalDependencyManager didn’t install PurchasesHybridCommon?

Download the latest version of Purchases.unitypackage.

Import the downloaded unitypackage to your Unity project. Make sure the PlayServiceResolver and the ExternalDependencyManager folders are also added. These folders will install the EDM4U plugin, which will add all the Android and iOS dependencies automatically when building your project.

Badge +1

What version are you trying to install? Can you try deleting the RevenueCat unitypackage from your project and try importing again? Maybe the ExternalDependencyManager didn’t install PurchasesHybridCommon?

Download the latest version of Purchases.unitypackage.

Import the downloaded unitypackage to your Unity project. Make sure the PlayServiceResolver and the ExternalDependencyManager folders are also added. These folders will install the EDM4U plugin, which will add all the Android and iOS dependencies automatically when building your project.

 

 

Trying again and having the exact same issue. I do have those folders.

By downloading EDM4U direct from github and importing it separately I have made some progress.

I get an error on build that looks like this:

 

 

Which is odd, because when I try to install cocoapods from the externaldependencymanager dropdown menu, I get this:

 

 

And then the resulting build won’t build from XCode.

I tried deleting and re-installing cocoapods, installing it successfully using externaldependencymanager. Still get the same error on building the project. 

 

tl;dr So basically the externaldependencymanager is there, it has cocoapods, but it is failing to install purchaseshybridcommon through cocoapods.

Update: this seems to be a broader issue with Unity and cocoapods (e.g. here https://forum.unity.com/threads/cocoapods-installation-failure-when-building-for-ios.1167700/) rather than anything specific to RevenueCat. I still haven’t gotten it working; there are fixes that work for others but not for me so far (downgrading cocoapods/reinstalling/un-checking “Use Shell to Execute Cocoapod Tool”)

Badge +1

Ok I can’t edit my last post any more, not sure why.

 

I was able to get beyond this, but only by manually running a command to get the right pods for M1 Mac, which must be done every time you build from Unity.

The podfile that gets spat out automatically is wrong in two ways: it includes stuff like Google Ads SDK (which I don’t want and can’t fix), and it pulls pods for intel-based Macs, not Apple Silicon Macs.


The command (run in the build folder) is arch -x86_64 pod install

That fixes cocoapods and installs the right dependencies.

Building from there still yields an XCode error, which requires disabling bitcode for UnityFramework. That’s doable and you can add a script to do it automatically each time.

 

But (so far as I can tell right now), this approach means running a manual cocoapods fix every time you build from unity, because the externaldependency manager is picking the wrong pods for Apple Silicon. Ihave to edit the podfile from

 

source 'https://cocoapods.mycompany.com/Specs'
source 'https://github.com/CocoaPods/Specs'
source 'https://cdn.cocoapods.org/'

platform :ios, '15.5'

target 'UnityFramework' do
  pod 'Google-Mobile-Ads-SDK', '~> 7.0', :path => '/Users/matt/Dropbox/UNITY_PROJECTS/google-mobile-ads-sdk'
  pod 'PurchasesHybridCommon', '4.5.4'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

 

to

 

source 'https://github.com/CocoaPods/Specs'
source 'https://cdn.cocoapods.org/'

platform :ios, '15.5'

target 'UnityFramework' do

  pod 'PurchasesHybridCommon', '4.5.4'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

 

..And then run the terminal command arch -x86_64 pod install

 

Hope that helps anyone who runs across the same issue anyway!

I have same issue on M1 mac, any update to solve it?

I have same issue on M1 mac, any update to solve it?

For anyone come here later, who has mistake like me.

As @Arbury Labs said, if you are using M-series chipset mackbook , you should do:

  • pod deintegrate 

  • remove Podfile.lock
  • arch -x86_64 pod install --repo-update

  • double click to open Unity-iPhone.xcworkspace (not Unity-iPhone.xcodeproj)

Hope it help!

Reply