capacitor-moengage-core 7.0.0 and requires Capacitor 7. Capacitor provides a migration assistant that converts the project to SPM. The steps in this guide cover the MoEngage-specific tasks that the assistant does not handle: the MoEngage pods that your Podfile declares by hand, and the push notification extension targets. For the Capacitor-specific migration steps, refer to Using Swift Package Manager in the Capacitor documentation.
The JavaScript code, SDK initialization, and dashboard configuration remain unchanged.
Migration Scope
The CocoaPods registry becomes read-only on December 2, 2026, and MoEngage publishes new SDK versions to CocoaPods until that date. After that date, new MoEngage SDK versions are available only through Swift Package Manager. MoEngage recommends planning the migration ahead of December 2, 2026.The migration assistant deletes the
Podfile, Podfile.lock, and App.xcworkspace. Migrate only after every other Capacitor plugin in your application supports SPM.Before You Begin
- Use Capacitor 7.
- Use
capacitor-moengage-core7.0.0 or later, and upgrade the MoEngage Geofence plugin if your application uses the Geofence plugin. - Confirm that every other plugin in your
package.jsonsupports SPM. The migration assistant warns about plugins that do not. - Identify which extension targets use MoEngage, such as a notification service extension or a content extension.
- Commit or back up the project, including the
iosdirectory.
Step 1: Upgrade the Packages
Upgrade the MoEngage plugin and the Capacitor packages, and then rebuild the web assets. The MoEngage plugin supports Capacitor 7 only, so pin the Capacitor packages to version 7. The@latest tag installs a later Capacitor major version, and SPM package resolution then fails.
Bash
Step 2: Note the Manually Declared MoEngage Pods
Before you run the assistant, openios/App/Podfile and note every MoEngage-iOS-SDK pod that the Podfile declares for the extension targets.
Podfile
Podfile, so the pods declared in the Podfile are removed with the file. You add the equivalent Swift package in Step 5. The capacitor-moengage-core plugin adds the MoEngage iOS SDK to the main app target automatically, so pods for the main app target need no replacement.
Step 3: Run the Migration Assistant
From the project root, run the following command:Bash
pod deintegrate, deletes the Podfile, Podfile.lock, and App.xcworkspace, creates the CapApp-SPM folder with a Package.swift generated from your plugins, and adds a debug.xcconfig file to the ios directory.
Step 4: Configure Xcode
-
Open the project in Xcode:
Bash
- Select the App project and open the Package Dependencies tab.
-
Click +, select Add Local, choose the
CapApp-SPMfolder, and click Add Package. Click Add Package again when the next screen appears. -
Open the Info tab of the App project, select Add Configuration file, choose
debug.xcconfig, and set its configuration to xcconfig. -
Under the main app target’s General > Frameworks, Libraries, and Embedded Content, confirm that
CapApp-SPMis present. IfCapApp-SPMisn’t listed, click + and add the package.
Step 5: Update the Push Notification Extensions
Complete this step only if your application has a notification service extension or a notification content extension that uses MoEngage. The extension targets aren’t part ofCapApp-SPM, so add the MoEngageRichNotification library manually:
- Open the Capacitor release notes, find your
capacitor-moengage-coreversion, and note the MoEngage-iOS-SDK version listed under Dependencies > iOS. - Select File > Add Package Dependencies, enter
https://github.com/moengage/apple-sdk.git, and set Dependency Rule to Exact Version with the version from the release notes. - On the product screen, set MoEngageRichNotification to the App target, and leave the other products set to None.
- In your notification service extension target, open General > Frameworks and Libraries, click +, and add MoEngageRichNotification. Do the same for your content extension target if you use push templates.
When you upgrade
capacitor-moengage-core in the future, open the Capacitor release notes, find the version you’re upgrading to, and note the MoEngage-iOS-SDK version listed for it. Then, in Xcode, open Package Dependencies, select apple-sdk, and change its Exact Version to that version. If the apple-sdk version doesn’t match the MoEngage-iOS-SDK version, package resolution fails.Step 6: Update Your Workflow
- After you add or remove an npm package, run
npx cap sync. Capacitor updatesCapApp-SPMfor you. Do not edit the contents ofCapApp-SPMmanually, because the Capacitor CLI can overwrite manual changes. - In CI and local scripts, remove every
pod installstep. Because the migration deletesApp.xcworkspace, build the.xcodeprojinstead.
Step 7: Verify the Migration
- In Xcode, select Product > Clean Build Folder.
-
Build and run the application:
Bash
- Confirm that the SDK initialization logs report the MoEngage SDK version that you upgraded to.
- Select Product > Archive and confirm that the archive succeeds. The archive build tests the extension targets in a release build.
- Send a test push notification. Confirm that the device receives the notification, that the SDK tracks the notification impression (the Notification Received event), and that rich content renders. If the application uses the Geofence plugin, verify geofence functionality as well.