Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This fake notification should be forwarded to firebase Swift5 iOS

I have gone through the official notification and followed all steps. Also APN certificates are already uploaded on firebase. When i push notifciation from Grow section manually, i receive notification but while while entering phone number with country code in my app, i am getting the following errors.

This fake notification should be forwarded to Firebase Auth

Optional(Error Domain=FIRAuthErrorDomain Code=17054 "If app delegate swizzling is disabled, remote notifications received by UIApplicationDelegate need to be forwarded to FIRAuth's canHandleNotificaton: method." UserInfo={NSLocalizedDescription=If app delegate swizzling is disabled, remote notifications received by UIApplicationDelegate need to be forwarded to FIRAuth's canHandleNotificaton: method., FIRAuthErrorUserInfoNameKey=ERROR_NOTIFICATION_NOT_FORWARDED})

In Google info.plist, isfirebaseProxyEnable is also set to No.

DidreceiveRemoteNotification method also implemented.

Please help me in solving this problem.

like image 566
Parul Verma Avatar asked Jan 17 '26 06:01

Parul Verma


2 Answers

To fix this, make sure you have this function in you AppDelegate file:

func application(_ application: UIApplication, didReceiveRemoteNotification notification: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    if Auth.auth().canHandleNotification(notification) {
        completionHandler(.noData)
        return
    }
}
like image 118
Sarth Shah Avatar answered Jan 19 '26 19:01

Sarth Shah


It seems that you don't have APNs set up correctly, check that:

  1. Push notifications is enabled in Capabilities of your app in Xcode settings.
  2. Background Modes is enabled in Capabilities of your app in Xcode settings and under it Remote notifications is checked
  3. Your app ID registered on apple developer site has Push Notification enabled
  4. Background refresh is not disabled on the device or for your app in iOS Settings

I assume that you have an internet connection during the tests.

If any points of the above need to change, just delete the app completely from the device before re-compile and run it again.

like image 29
FedeH Avatar answered Jan 19 '26 20:01

FedeH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!