Install the iOS dependencies for the MoEngage React Native plugins with either CocoaPods or Swift Package Manager (SPM). CocoaPods is the default for this release. MoEngage publishes new SDK versions to CocoaPods until December 2, 2026, and SPM support is experimental. To move an existing app to SPM, refer to Migrate From CocoaPods to SPM.
From Core 13.0.0, the plugins support only the React Native New Architecture, so they require React Native 0.68 or later with the New Architecture enabled. It is on by default from React Native 0.76. If your application disables it, enable it before you upgrade.
Due to the CocoaPods Specs Repo deprecation, you must explicitly define your dependency sources for your project to build successfully.Add the following lines at the very top of your Podfile, above any target blocks:- MoEngage Source is required to successfully resolve and fetch MoEngage-specific SDK pods.
- CocoaPods Source is required to ensure all your other standard third-party React Native dependencies continue to resolve correctly.
To install the iOS dependencies, follow these steps:
-
Navigate to the
ios directory.
-
Run the following command:
On React Native 0.68 to 0.75, the New Architecture is off by default. Run RCT_NEW_ARCH_ENABLED=1 bundle exec pod install --repo-update instead, so that pods install for the New Architecture.
Supported Packages
The following packages support SPM:
react-native-moengage
react-native-moengage-cards
react-native-moengage-geofence
react-native-moengage-inbox
react-native-moengage-personalize
Integration Steps
-
Install the npm packages as usual:
-
Navigate to the
ios directory and set up SPM:
-
If the iOS project still uses CocoaPods, which includes a new application created from the React Native template, convert it once:
For more information, refer to Migrate From CocoaPods to SPM.
-
If the iOS project already uses SPM, run:
This command is the SPM equivalent of pod install. It runs codegen, regenerates the autolinking graph, and links React Native’s prebuilt frameworks. The first run takes longer because it downloads and caches those frameworks.
-
Run
npx react-native spm again after a fresh clone, after resetting node_modules, and after any dependency change. Unlike CocoaPods, npx react-native run-ios does not run it automatically.
-
Build and run with
npx react-native run-ios, or open ios/<YourApp>.xcodeproj in Xcode. Open the .xcodeproj, not the .xcworkspace: with SPM the workspace is no longer used.
-
In
ios/<YourApp>/AppDelegate.swift, import the plugin module and the MoEngage SDK:
The module name is the same as with CocoaPods.
With SPM you no longer run pod install. The MoEngage native SDKs resolve automatically from their SPM repositories. Keep ios/Podfile: the React Native CLI still uses it to detect the iOS project, even though CocoaPods no longer installs anything.Limitations
After you switch to SPM, no target in the Xcode project, including the notification extensions, can use CocoaPods. Use CocoaPods or SPM for the whole application, not both.
- Minimum iOS version is 15.0. React Native’s generated SPM packages require iOS 15, so this value cannot be lowered. To set it, open
ios/<YourApp>.xcodeproj, select the app target, and set General > Minimum Deployments to 15.0. Do the same for any notification extension targets. The Podfile platform :ios line no longer applies. CocoaPods retains iOS 13.
- tvOS is not supported. React Native’s prebuilt frameworks have no tvOS slice. tvOS applications must use CocoaPods.
- Expo is not supported. The
react-native-expo-moengage package has no SPM manifest. Expo applications keep using the MoEngage Expo config plugin, with no change.
- Don’t add the MoEngage iOS SDK (
apple-sdk) to Xcode yourself. The plugins already include it, including MoEngageRichNotification for push extensions. If your own extension code needs it, match the exact version the plugin uses. For more information, refer to Set Up iOS Notification Extensions for Rich Push and Impression Tracking.
- Every other React Native library in the application must also support SPM, either through its own
Package.swift or through npx react-native spm scaffold. This constraint comes from the React Native ecosystem, not from MoEngage.