Rajesh Maurya
Rajesh Maurya

Reputation: 3164

Firebase iOS Push notification not receiving on first app launch

I follow all the steps given in below link. https://firebase.google.com/docs/cloud-messaging/ios/client#analytics-enabled Firebase version : Firebase 7.3.0

The notification is working if I quit fist launch. Then there is no problem. Only having issue for the first time app launch.

Upvotes: 2

Views: 1280

Answers (2)

YodagamaHeshan
YodagamaHeshan

Reputation: 6500

Disabling method swizzling worked for me.

method swizzling: giving APNS token to firebase by ourself instead of letting firebase to take it automatically.

**

To disable method swizzling:

( 1 ). Add FirebaseAppDelegateProxyEnabled the app’s Info.plist file and setting it to NO (boolean value).

enter image description here


( 2 ). Implement the application(_:didRegisterForRemoteNotificationsWithDeviceToken:) method of UIApplicationDelegate to retrieve the APNs token, and then set Messaging's apnsToken property:

func application(application: UIApplication,
                 didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
  Messaging.messaging().apnsToken = deviceToken
}

**

Upvotes: 0

Princess
Princess

Reputation: 319

I had the same issue while googling a lot I found a lot and this works for me by downgrading the firebase SDK version:

pod 'Firebase/Messaging', '~> 6.33.0' pod 'Firebase/Analytics', '~> 6.33.0'

I hope this could help you. And it seems the Firebase team has not yet fixed this issue in their new milestone

Upvotes: 2

Related Questions