Problem
Push notifications were sent successfully from the MoEngage dashboard, but they were not delivered to the user in the foreground, background, or killed state on iOS.
Explanation
The following could be the factors for push notifications not working in all states:
- The user is in the Test Environment, but push notifications were sent from the Live environment.
- The user is in the Live Environment, but push notifications were sent from the Test environment.
- User data is not being tracked to the correct profile. For example, push notifications are sent to the email xyz@mail_domain.com, but no data is tracked on the user's profile. This indicates an issue with the SDK integration or that the user was logged out, causing a guest profile to be created.
Solution
Perform the following steps to resolve the issue:
- Check the user profile. Verify whether recent events are being tracked on the user profile.
- If no recent events are found, the wrong profile may be targeted for push notifications, indicating an SDK integration issue.
- If no recent events are found, the wrong profile may be targeted for push notifications, indicating an SDK integration issue.
- Check SDK integration. Common SDK-related issues include:
- The data center was incorrectly set when initializing the SDK, or the wrong data center was used.
MoEngage MoEngage_APP_ID XXXXXXXXXXXX DATA_CENTER DATA_CENTER_0X ENABLE_LOGS
//7.xx ///Obj-C sdkConfig.moeDataCenter = DATA_CENTER_0X; ///Swift sdkConfig.moeDataCenter = DATA_CENTER_0X //7.xx Alternative ///Obj-C [MoEngage setDataCenter:DATA_CENTER_0X]; ///Swift MoEngage.setDataCenter(DATA_CENTER_0X) //8.xx ///Obj-C sdkConfig.moeDataCenter = MODataCenterData_center_0X; ///Swift sdkConfig.moeDataCenter = .data_center_0X //9.xx ///Obj-C sdkConfig.moeDataCenter = MoEngageDataCenterData_center_0X; ///Swift sdkConfig.moeDataCenter = .data_center_0X //9.xx Alternative ///Obj-C MoEngageSDKConfig* sdkConfig = [[MoEngageSDKConfig alloc] initWithAppId:@"XXXXXXXXXXXXXXXX" dataCenter: MoEngageDataCenterData_center_0X]; ///Swift var sdkConfig = MoEngageSDKConfig.init(appId: "XXXXXXXXXXXXXXXX", dataCenter: .data_center_0X)
- A force logout occurred, leading to a guest profile being created, which prevents push notifications from working.
- A force logout can occur in the following scenarios:
- The developer sets a unique_id (For example, unique_id_001).
- Without calling the MoEngage logout or reset user function, the developer sets a new unique_id (For example, unique_id_002).
- The data center was incorrectly set when initializing the SDK, or the wrong data center was used.