Reputation: 1929
Hi all I am new to iOS development, I have put in the deep end to get push notifications. I found pushsharp and was using this tutorial
I have used a windows application instead of web application and add the latest pushsharp. The code build and runs but i get the following exception
The error happens at the following location
I have revoked my certificate and recreated it several times and also i have tried exporting the certificate and the key. Both give me the same error.
When I am creating the certificate, I created one for iOS Development in Apple portal.
This is what I have tried so far Based on comment from Jack Hua, i have tried the following
Logged into apple portal and deleted
Xamarin visual studio has no provisioning profile as expected
Starting with a Clean slate
Now create the APNs develpment certificate
I still get the same Apns connection error.
What am i missing?
Based on Jack Hua comment I have further made this attempt. I have set the validation flag to false, I still get the connection error however the inner exception is 'Invalid Device Token'
Made a bit of progress after some research, the device token i had has spaces removing the spaces i do not get any errors however the notification is never shown on my iPad. I am using Sandbox and iOS development certificates, provisioning profiles. Wondering is this a know issue in development and it will work in production. Any help is greatly appreciated guys!!!
Upvotes: 0
Views: 595
Reputation: 15816
That error message is generated when creating an ApnsConfiguration object, see source code.
if (!Regex.IsMatch (commonName, "Apple.*?Push Services")
&& !commonName.Contains ("Website Push ID:"))
throw new ArgumentOutOfRangeException ("Your Certificate is not a valid certificate for connecting to Apple's APNS servers");
You are not creating a push certification... The tutorial you are following is creating a distribution provisioning profile that allows you to submit your app to the Apple App Store (not notification).
You can follow this document to generate a notification certification and config your app to enable the ability of push notofication.
Refer: send-push-notification-to-ios-pushsharp-certificate
Upvotes: 1