> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Flutter、Objective-C、MoEngage-iOS-SDK（バージョン 7.x.x、8.x.x、9.x.x）を使用する iOS デバイスで、プッシュ通知の一般的な問題を回避するにはどうすればよいですか？

> Flutter と Objective-C を使用する iOS でのプッシュ通知の問題を解決します。Firebase プロキシ設定、ディープリンク、MoEngage SDK の設定について説明します。

## 問題

Flutter、Objective-C、MoEngage-iOS-SDK（バージョン 7.x.x、8.x.x、9.x.x）を使用する iOS デバイスで、配信の失敗、画面遷移、ディープリンク、リッチランディングなど、プッシュ通知に関する一般的な問題が発生しています。

## 解決策

以下の手順を実行します。

1. **Firebase プロキシ**:
   * Firebase プッシュ通知を使用していない場合は、info.plist に FirebaseAppDelegateProxyEnabled キーを値 Boolean = False/NO で追加して、Firebase プロキシを無効にします。
   * プッシュ通知をテストします。成功した場合、それ以上の操作は不要です。成功しない場合は、以下の手順に従ってください。
   * Firebase プッシュ通知を使用している場合は、この手順をスキップして次の手順に進みます。
2. **MoEngage プロキシを無効にする**:
   * info.plist に MoEngageAppDelegateProxyEnabled キーを値 Boolean = false/NO で追加します
     <img alt="boolean.png" src="https://mintcdn.com/moengage/2FjM3dGfEH1CYo8k/images/moengage_6550ce.png?fit=max&auto=format&n=2FjM3dGfEH1CYo8k&q=85&s=240add700575e9c1980eb55215eda271" width="1958" height="570" data-path="images/moengage_6550ce.png" />
3. **didRegisterForRemoteNotificationsWithDeviceToken 関数をオーバーライドする**:
   * AppDelegate.m ファイルの didRegisterForRemoteNotificationsWithDeviceToken 関数をオーバーライドします。
     ```swift Objective-C theme={null}
     - (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];
     }
     ```
4. **UNUserNotificatoinCenterDelegate 関数をオーバーライドする**:
   * AppDelegate.m ファイルの UNUserNotificatoinCenterDelegate 関数をオーバーライドします。
     ```objective-c Objective-C wrap theme={null}
     //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();
     }
     ```
