Mil*_*lya 5 iphone notifications apple-push-notifications ios ios8
我为服务器配置了apns_certificate.pem和apns_privatekey.pem.我正在使用node.js服务器发送推送通知.我已成功向apns服务器发布通知,但设备未收到任何推送通知.
我还经历了推送通知疑难解答.我按照故障排除文档中的描述,通过服务器端的命令检查了所有pem文件.
$ openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert YourSSLCertAndPrivateKey.pem -debug -showcerts -CAfile server-ca-cert.pem
Run Code Online (Sandbox Code Playgroud)
它很成功.
我检查了我的服务器能够通过以下命令连接到apns服务器.
$ telnet 1-courier.push.apple.com 5223
$ telnet gateway.sandbox.push.apple.com 2195
$ telnet gateway.push.apple.com 2195
Run Code Online (Sandbox Code Playgroud)
我在iOS项目上正确配置它,我也得到了设备令牌.
但我仍然没有在我的设备上获得推送通知.
小智 -2
请检查设备令牌是否有效。对于哪个设备令牌,服务器发送推送通知。此外,推送通知还应检查应用程序后台模式。
如果以上所有内容正确,您将收到推送通知。
另请检查应用程序委托中的这两个方法,并将设备令牌从 iOS 应用程序发送到服务器:
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSString *str = [NSString stringWithFormat:@"Device Token=%@",deviceToken];
str = [str stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"This is device token%@", str);
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
NSString *str = [NSString stringWithFormat: @"Error: %@", err];
NSLog(@"Error %@",err);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
768 次 |
| 最近记录: |