問題
iOSデバイスでFlutter、Swift、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 ファイルの didRegisterForRemoteNotificationsWithDeviceToken 関数をオーバーライドします。
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { 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 ファイルの didRegisterForRemoteNotificationsWithDeviceToken 関数をオーバーライドします。
-
UNUserNotificationCenterDelegate関数のオーバーライド
:
-
AppDelegateファイルでUNUserNotificationCenterDelegate関数をオーバーライドします。
//Try without willPresent if it works good to go! else override it override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) - Void) { if #available(iOS 14.0, *) { completionHandler([.sound,.alert, .banner, .list]) } else { completionHandler([.sound,.alert]) } } override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () - Void) { super.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler) //7.xx version MoEngage.sharedInstance().userNotificationCenter(center, didReceive: response) //8.xx version MOMessaging.sharedInstance.userNotificationCenter(center, didReceive: response) //9.xx version MoEngageSDKMessaging.sharedInstance.userNotificationCenter(center, didReceive: response) }
-
AppDelegateファイルでUNUserNotificationCenterDelegate関数をオーバーライドします。