問題
iOSデバイスでFlutter、Objective-C、MoEngage-iOS-SDK(バージョン7.x.x、8.x.x、9.x.x)を使用している場合、プッシュ通知に関する一般的な問題には、配信失敗、画面ナビゲーション、ディープリンク、リッチランディングが含まれます。
ソリューション
次の手順を実行します。
-
Firebaseプロキシ
:
- Firebaseプッシュ通知を使用していない場合は、info.plistにFirebaseAppDelegateProxyEnabledキーを追加し、Boolean値をFalse/NOに設定してFirebaseプロキシを無効にします。
- プッシュ通知をテストします。成功した場合、これ以上のアクションは必要ありません。そうでない場合は、以下の手順に従ってください。
- Firebaseプッシュ通知を使用している場合、このステップをスキップし、以下の手順に進んでください。
-
MoEngageプロキシを無効にする
:
-
info.plistにMoEngageAppDelegateProxyEnabledキーを追加し、値をBoolean = false/NOに設定します
-
info.plistにMoEngageAppDelegateProxyEnabledキーを追加し、値をBoolean = false/NOに設定します
-
didRegisterForRemoteNotificationsWithDeviceToken 関数をオーバーライドする
:
-
AppDelegate.m ファイルの didRegisterForRemoteNotificationsWithDeviceToken 関数をオーバーライドします。
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [super application: application didRegisterForRemoteNotificationsWithDeviceToken: deviceToken]; //7.xx version [[MoEngage sharedInstance] setPushToken:deviceToken]; //8.xx version [[MOMessaging sharedInstance] setPushToken:deviceToken]; //9.xx version [[MoEngageSDKMessaging sharedInstance] setPushToken:deviceToken]; }
-
AppDelegate.m ファイルの didRegisterForRemoteNotificationsWithDeviceToken 関数をオーバーライドします。
-
UNUserNotificationCenterDelegate 関数のオーバーライド
:
-
AppDelegate.m ファイルで UNUserNotificationCenterDelegate 関数をオーバーライドします。
//Try without willPresent if it works good to go! else override it - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { if (notification.request.content.userInfo != nil) { NSDictionary *dictionary = notification.request.content.userInfo; if (dictionary[@"moengage"] != nil) { completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge); } else { [super userNotificationCenter: center willPresentNotification: notification withCompletionHandler:completionHandler]; } } - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler { [super userNotificationCenter: center didReceiveNotificationResponse: response withCompletionHandler: completionHandler]; //7.xx version [[MoEngage sharedInstance] userNotificationCenter:center didReceiveNotificationResponse:response]; //8.xx version [[MOMessaging sharedInstance] userNotificationCenter:center didReceive:response]; //9.xx version [[MoEngageSDKMessaging sharedInstance] userNotificationCenter:center didReceive:response]; completionHandler(); }
-
AppDelegate.m ファイルで UNUserNotificationCenterDelegate 関数をオーバーライドします。