Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push Notifications only works when the provisioning profile is iOS development type, AdHoc and Production not working #1046

Open
zhenjiangliu24 opened this issue Sep 15, 2020 · 6 comments

Comments

@zhenjiangliu24
Copy link

Similar issue as https://github.com/firebase/quickstart-ios/issues/207

When the provisioning profile type is Development, everything works as expected
When the provisioning profile type is Ad hoc or Production, no push notification is delivered

Versions for FirebaseMessagingBinary and all other Firebase SDKs: 6.32.0

What I have already tried:

  1. Approach One, followed https://github.com/firebase/quickstart-ios/issues/207#issuecomment-274820033:

1 - Make sure to Enable FirebaseAppDelegateProxyEnabled to YES in the info.plist
2- Revoke your certificate (APNS develop and distribution) and create a news ones
3 - NOTE: there is an error in the Firebase documentation. When you exporting the APN certificate for production from your > keychain to the .p12 file you have to select the actual certificate, not the private key.
4 - Make sure you upload to the Firebase console this .p12 file in the Cloud Messaging APN certificate settings.
5- Send remote notification with Firebase Console.

  1. Approach Two: followed https://stackoverflow.com/a/41696213
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

    #if DEVELOPMENT
        //Develop
        Messaging.messaging().setAPNSToken(deviceToken as Data, type: .sandbox)
    #else
        //Production
        Messaging.messaging().setAPNSToken(deviceToken as Data, type: .prod)
    #endif

}
  1. Approach Three:

When you exporting the APN certificate for production from your keychain to the .p12 file you have to select the actual
certificate, not the private key

Any ideas about how to solve this issue, please

@zhenjiangliu24
Copy link
Author

Please help

@morganchen12
Copy link
Contributor

What version of Firebase are you using? You should be able to set the APNs token without setting the type without issues.

@zhenjiangliu24
Copy link
Author

@morganchen12 the firebase iOS SDK version is 6.32.0

@morganchen12
Copy link
Contributor

Unfortunately I won't be able to help much without a reproducible example, but you can try using Messaging.messaging().apnsToken = deviceToken instead of explicitly specifying the token type.

@zhenjiangliu24
Copy link
Author

@morganchen12 I have already tried this, but no luck
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { Messaging.messaging().setAPNSToken(deviceToken as Data, type: .unknown) }

@jwoyo
Copy link

jwoyo commented May 5, 2021

any updates on this? I experience the exact same issue with firebase_messaging 9.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants