Why push notifications is not working on testfligh

2019-01-08 06:44发布

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 notification but the data is correctly received, So is there a kind of certificate that i need to generate for TestFlight?

6条回答
ゆ 、 Hurt°
2楼-- · 2019-01-08 07:19

For TestFlight, use

  1. Production certificate
  2. "gateway.push.apple.com" at the server(back end job)
放我归山
3楼-- · 2019-01-08 07:31

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.

查看更多
看我几分像从前
4楼-- · 2019-01-08 07:31

If you use Firebase, you have to add in:

  • TestFlight:

    -(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
        [[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeSandbox]; 
    }
    
  • Production:

    -(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
        [[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeProd]; 
    }
    
查看更多
做自己的国王
5楼-- · 2019-01-08 07:38

if you used GCM. In Development:-

_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                             kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};

In Distribution:-

_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                             kGGLInstanceIDAPNSServerTypeSandboxOption:@NO};
查看更多
Animai°情兽
6楼-- · 2019-01-08 07:44

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);
查看更多
神经病院院长
7楼-- · 2019-01-08 07:45

1.You need to use production certificate for testflight build. 2. Also need to remove sanbox (sandbox mode) from push notification url in push sending script.

登录 后发表回答