APNS notifications not reaching devices enrolled in Apple MDM
Follow MDM_Protocol pdf very carefully.
If you are following this link: http://www.softhinker.com/in-the-news/iosmdmvendorcsrsigning
Then verify few things.
remove the passphrase from customerPrivateKey.pem using this command
openssl rsa -in customerPrivateKey.pem -out PlainKey.pem
Then merge your APNS certificate (for example CustomerCompanyName.pem) downloaded from the portal https://identity.apple.com/pushcert/ using this command
cat CustomerCompanyName.pem PlainKey.pem > PlainCert.pem
Now this PlainCert.pem file can be used in your server as APNS/MDM certificate.
If still there is issue,please show here your device log.
MDM: APNS notification does not reach iPhone
My suggestion is first try production APNS , so use this url:gateway.push.apple.com, and if you are using IPCU to generate mobileconfig,then in MDM payload don't select the option "Use Development APNS Server".
And see this also.
iOS MDM push notification using Php, not working
I've had a go at pushing notifications myself, using PHP on Windows. One of the things I've noticed that might be wrong is your inclusion of the topic in the push payload. This isn't required.
Here is some PHP code I've written to test using a device I registered in TestMDM. I'm not a PHP developer, but using this (http://codular.com/sending-ios-push-notifications-with-php) as a baseline and taking the pushMagic and deviceToken strings from my TestMDM database, I got it to successfully send a push.
As I'm on Windows, I also use a PFX certificate for push.
$deviceToken = '<YOUR DEVICE TOKEN AS BASE64 STRING>'; #base64 encoded
$token = bin2hex(base64_decode($deviceToken));
// Put your private key's passphrase here:
$passphrase = '<YOUR PASSWORD>';
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', './Push.pfx');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
$fp = stream_socket_client('gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
if (!$fp) {
exit("Failed to connect: $err $errstr" . PHP_EOL);
}
echo 'Connected to APNS' . PHP_EOL . "<br />";
$payload = '{ \'mdm\' = \'<YOUR PUSH MAGIC FOR THIS DEVICE>\' }';
$inner = chr(1) . pack('n', 32) . pack('H*', $token)
. chr(2) . pack('n', strlen($payload)). $payload
. chr(3) . pack('n', 4) . pack('N', 1)
. chr(4) . pack('n', 4)
. pack('N', time() + 86400)
. chr(5) . pack('n', 1) . chr(10);
$notification = chr(2) . pack('N', strlen($inner)) . $inner;
echo $payload . PHP_EOL;
$result = fwrite($fp, $notification, strlen($notification));
echo $result;
Once I run the script, I can see this in the logs of my device, which indicates it is working:
Jul 11 10:16:10 Toms-iPod mdmd[11218] <Notice>: (Note ) MDM: mdmd starting...
Jul 11 10:16:10 Toms-iPod mdmd[11218] <Notice>: (Note ) MDM: Network reachability has changed.
Jul 11 10:16:10 Toms-iPod mdmd[11218] <Notice>: (Note ) MDM: Network reachability has changed.
Jul 11 10:16:10 Toms-iPod mdmd[11218] <Notice>: (Note ) MDM: Push token received.
Jul 11 10:16:10 Toms-iPod mdmd[11218] <Notice>: (Note ) MDM: Received push notification.
Jul 11 10:16:10 Toms-iPod mdmd[11218] <Notice>: (Note ) MDM: Polling MDM server https://testmdm.azurewebsites.net/<redacted> for next command.
Hopefully this will help.
T
Related Topics
Ionic 2, Using Angular 2 Pipe Breaks on iOS-"Can't Find Variable: Intl"
Tableview:Numberofrowsinsection:]: Unrecognized Selector Sent to Instance
Passing Data from App Delegate to View Controller
Facebooksdk and Bolts Conflicting Each Other (Duplicate Symbols) on Build
Using Core Data with Watchos 2.0
Getting Url of Uiimage Selected from Uiimagepickercontroller
iOS 11 Uitableview Delete Rows Animation Bug
iOS App Won't Run on Device Any More Under iOS 12: Unrecoverable Ct Signature Issue
Can Siri Be Invoked Programmatically Within My App Using Private APIs
How to Center Crop an Image in Swiftui
Application Loader Stuck at the Stage of "Verifying Assets with the Itunes Store"
Iphone, Obtaining a List of Countries in an Nsarray
Add Segmented Control to Navigation Bar and Keep Title with Buttons
Is There Function to Convert Uicolor to Hue Saturation Brightness