Why push notifications is not working on testflight?

前端 未结 9 1844
情话喂你
情话喂你 2020-11-29 20:06

I have tested push notifications as a developer account and it worked, But when i tried to put it on TestFlight for the testers to test it, it didn\'t show a push notificati

相关标签:
9条回答
  • 2020-11-29 20:58

    We need two certificates for sending notifications, one for development and one for production. In my case I'm using PushSharp solution to send notification .

    This is for development:

    var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, "development.p12", "password");
    var broker = new ApnsServiceBroker(config);
    

    This is for Production:

    var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Production, "production.p12", "password");
    var broker = new ApnsServiceBroker(config);
    
    0 讨论(0)
  • 2020-11-29 21:00

    For someone uses Python apns (https://github.com/djacobs/PyAPNs):

    When you create APNS object such apns = APNs(cert_file="cert.pem", key_file="key.pem"). You need to add one more parameter use_sandbox. It will be apns = APNs(use_sandbox=False, cert_file="cert.pem", key_file="key.pem").

    Happy coding.

    0 讨论(0)
  • 2020-11-29 21:01

    But when i tried to put it on TestFlight for the testers to test it, it didn't show a push notification but the data is correctly received.

    That sentence is confusing. If you didn't get the push notification, what data is correctly received?

    Anyway, if I recall correctly, for TestFlight you are using an AdHoc provisioning profile, which works with the production push environment. Therefore you'll need a production push certificate in order to push to devices that installed the app via TestFlight. In addition, don't forget that development device tokens are different than production device tokens, so make sure you are using the correct tokens.

    0 讨论(0)
提交回复
热议问题