简体   繁体   English

iPhone发送iPhone推送通知问题

[英]iPhone Push Notifications Problems With iPhone sending

I'm trying to send iPhone push notifications ideally via VB.Net, although I can send them via PHP. 我正在尝试通过VB.Net理想地发送iPhone推送通知,尽管我可以通过PHP发送通知。 I have tried both methods (which works fine for Android) but they fail for iPhone (ios). 我尝试了两种方法(对Android都适用),但对iPhone(ios)却失败。

Here is the code I have been using and the problems I get: 这是我一直在使用的代码以及出现的问题:

VB.Net VB.Net

Dim appleCert As Byte()
appleCert = File.ReadAllBytes("C:\AppleAppKey\aps_development.p12")
push.RegisterAppleService(new ApplePushChannelSettings(appleCert, "123xxx321"))
push.QueueNotification(new AppleNotification() _ .ForDeviceToken("06611dd37b6e0fff87da9edd8j97ddf337246274e0dd3a77fc7d7a14") _
    .WithAlert("Hello World!") _
    .WithBadge(7) _
    .WithCustomItem("content-available", 1))

ERROR: NO Error returned but no notification is sent to the phone. 错误:否返回错误,但没有通知发送到电话。

PHP 的PHP

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'cafile', 'entrust_2048_ca.cer');
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', self::$passphrase); 
$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60,STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); 

ERROR: stream_socket_client() SSL: The specified procedure could not be found. 错误:stream_socket_client()SSL:找不到指定的过程。

I have created an Apple Developer account and created .pem .p12 .cer files. 我已经创建了一个Apple Developer帐户并创建了.pem .p12 .cer文件。 I have also tested the Apple connection via telnet 我还通过telnet测试了Apple连接

openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert ios_development.pem -key aps_development.pem  -CAfile entrust_2048_ca.cer

and this works. 这可行。

Can someone please point me in the right direction? 有人可以指出正确的方向吗?

The solution was to recreate the notification SSL again (third time) and it worked fine. 解决的方法是再次(第三次)重新创建通知SSL,并且工作正常。

Hard going when I can't see any feedback from apple servers to say the initial ssl certs were rejected. 当我看不到来自苹果服务器的任何反馈来说最初的ssl证书被拒绝时,很难做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM