Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple Push Notification Service

i tried to run using local mac machine but go the following errors

Warning: stream_socket_client() [function.stream-socket-client]: Unable to set private key file `/Applications/XAMPP/xamppfiles/htdocs/apns/apns-dev.pem’ in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: stream_socket_client() [function.stream-socket-client]: failed to create an SSL handle in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: socket_close() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 11

Warning: fclose() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 12

I got PEM certificated generated from other machine,

So I am totally confused what I have to do now.

Please let me know what I need to do to run it in localhost

like image 777
Kamal Challa Avatar asked Sep 26 '09 15:09

Kamal Challa


People also ask

What does Apple Push Notification Service do?

Unlike iOS users, Android users are automatically opted in to receive push notifications, this leads to new Android users being more likely to be opted-in to notifications. On the other hand, Android users are quick to opt-out of notifications that they don't want to receive.

Can I disable Apple push service?

You can disable push notifications on Android by going into the Settings > Notifications options. Similar to iOS, Android lets you turn off push notifications for individual apps or use a 'Do not disturb' mode.

What is Apple Push app?

Apple Push Notification service (APNs) is a cloud service that allows approved third-party apps installed on Apple devices to send push notifications from a remote server to users over a secure connection. For example, a newstand app might use APNs to send a text alert to an iPhone user about a breaking news story.


1 Answers

I think that you may have exported the certificate, but not the private key from the .cer file that apple supplies.

These instructions from markbates might help out:

Once you have the certificate from Apple for your application, export your key and the apple certificate as p12 files. Here is a quick walkthrough on how to do this:

  1. Click the disclosure arrow next to your certificate in Keychain Access and select the certificate and the key.
  2. Right click and choose Export 2 items….
  3. Choose the p12 format from the drop down and name it cert.p12.

Now covert the p12 file to a pem file:

$ openssl pkcs12 -in cert.p12 -out apple_push_notification_production.pem -nodes -clcerts
like image 152
jessecurry Avatar answered Sep 23 '22 18:09

jessecurry