Search code examples
react-nativein-app-purchasereact-native-iosrevenuecat

Setting up RevenueCat Purchases in ReactNative throws "NativeModule" cannot be null error


I have followed the installation instructions and got the project to build successfully. Now, when I import Purchases in my javascript code I get the exception "Native module cannot be null".

Native module cannot be null error

The NativeModules object imported from react-native does not have the RNPurchases module that the required by react-native-purchases.

System

XCode 10
MacOS Mojave
React Native 0.50.4


Solution

  • The issue here is that the built binary of the RNPurchases subproject is not automatically linked to the project.

    1. Go to the General tab in your project's target
    2. Click + in Linked Frameworks and Libraries
    3. Add libRNPurchases.a