Apple Push Notifications - Unable to Send Messages to APNs (from local dev machine)

Nov 22, 2011 at 2:00 AM
Edited Nov 24, 2011 at 1:25 AM

Has anyone been able to successfully send a push notification to the Apple Push Notification service using this toolkit?

If you have, were you be able to do it from your local dev machine or must the toolkit code be deployed to real Azure for APNs to work?

What does the toolkit portal UI say when it thinks that the Push Message was successfully delivered to the APNs Development sandbox server?

 If you have it working, can you clarify the EXACT certificates (.cer) file(s) and .p12 file(s) you had to install onto your dev machine to get it to work? In your Certificate store, which node(s) did you install each of the certs/p12/keys whatever to?

There are many places where this can go wrong and I am getting various errors in the sample's UI and in Visual Studio on my dev PC. I have changed certificate settings around and done other things to troubleshoot but I just want to see if anyone has it working. I don’t want to waste any more time on it if it just doesn’t work yet.

Nov 22, 2011 at 3:35 PM

I'm not familiar with the Apple notification services, but be careful on which CAs you use. Not all are trusted by every service. Had a lot of trouble with this very toolkit because my cert was not recognized by WP7 (by windows, yes, but not WP7 - see http://msdn.microsoft.com/en-us/library/gg521150(v=VS.92).aspx).

You could be hitting a roadblock with your CAs so your question is quite appropriate.  Just wanted to contribute to the subject.

Best of luck,

Nov 22, 2011 at 4:43 PM
Edited Nov 24, 2011 at 1:23 AM

 

Thanks andress. I believe it is an issue with getting all of the certificates, CAs, and all the other related stuff in the right place and/or read rights to them. I am going to give up on the local test and deploy it to Azure to see if it works to isolate if it is a certificate creation problem or if it is just Visual Studio/SLN that is unable to access the local Windows 7 cert store because of some dumb local permission issue.

Nov 24, 2011 at 1:18 AM
Edited Nov 24, 2011 at 5:14 PM

This is a great sample and very helpful to get started quickly. The Windows Azure Toolkit for Windows Phone v1.3.1 (Mon Oct 24 2011) DOES work with the Apple Push Notification service BUT you may waste a lot of time trying to get it working on your LOCAL dev machine. If for whatever reason the sample code, Visual Studio, local Azure emulators, or whatever can’t get easy access to your local machine's Certificate store, you may just want to test in real Azure first. I wasted a lot of time trying to get the sample to run locally and still can’t get APNs to work with my locally installed Apple certificates. If you find yourself in this position, just publish the sample and your certificates/keys directly to Azure to see that APNs works. I deployed the same certs I installed locally (that didn't work) into Azure and all worked fine. You can waste time troubleshooting on your local machine later if needed. Some troubleshooting info specific to this sample from the MS people that understand the local cert store and Windows security would be great as I suspect it fails locally for me because of some permission/policy issue.

Another thing to note if you do try to use this sample on your local dev machine is that the sample's new project wizard presents a dialog to you to select the APNs certificate to use (from Apple) if you check the box for the Apple Push Notification Service. This dialog pop-up only shows you choices from your LOCAL COMPUTER (MACHINE) "Personal\Certificates" node. It does NOT show you the certs that you have installed under the "Current User" node so install your Apple APNs cert into the former. This will at least let you select the cert in the wizard but sending a message to the APNs still may not work when you run the sample locally. I received various errors when I attempted to dev locally (ex: "There was an error sending the notification message: The credentials supplied to the package were not recognized").

Lastly, the "Apple Push Notification" page in the Web site that the sample creates has the phrase "Device Id" under the Notification section. This can be misleading to APNs/iOS newbies like me because this field is NOT for the unique ID of the phone/device. This text box is for the DEVICE TOKEN that the APNs assigns to the device when it registers with APNs. The label should probably say, "Device Token" instead of "Device Id". You can see the DEVICE TOKEN that APNs assigns to the app+device inside of the Xcode Output window if you run the "WAToolkit" app code that MS provides on github while the client device is connected to your Mac.