i'm using apns notifications to send push notification to ios devices, when i use a production certificate everything works fine, but when i use a development certificate i keep getting : A call to SSPI failed, see inner exception : The message received was unexpected or badly formatted although i'm changing the sandbox to true
any advice ?
below is my code :
public bool PushMessage(string testDeviceToken, string message, NotificationService service, int i, string szHiddenMessage,string tag)
{
var payload1 =new NotificationPayload();
try
{
payload1 = new NotificationPayload(message, 1, "Default");
payload1.AddCustom("message", szHiddenMessage);
var push = new Notification(testDeviceToken, payload1);
alertNotification.Payload.Alert.Body = message;
if (service.QueueNotification(push))
{
UpdateListBox("Notification Queued! " + message);
return true;
}
UpdateListBox("Notification Failed to be Queued!");
return false;
}
catch (Exception ex)
{
Global.WriteToText("PushMessage.", "Exception: {0}" + ex.Message.ToString());
return false;
}
}
this is how i call the above function :
private void SendPushNotifications(DataTable tblToPush)
{
string szSandbox = "";
string szFile ="";
string szPassword ="";
szSandbox = NGlobal.fnGetConfig("sandbox");
szFile = NGlobal.fnGetConfig("p12File");
szPassword = NGlobal.fnGetConfig("p12FilePassword");
bool sandbox = false;
sandbox = true;
string p12File = szFile;
string p12FilePassword = szPassword;
string p12Filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, p12File);
NotificationService service = new NotificationService(sandbox, p12Filename, p12FilePassword,1);
service.SendRetries = 5;
service.ReconnectDelay = 5000;
service.Error += new NotificationService.OnError(service_Error);
service.NotificationTooLong += new NotificationService.OnNotificationTooLong(service_NotificationTooLong);
service.BadDeviceToken += new NotificationService.OnBadDeviceToken(service_BadDeviceToken);
service.NotificationFailed += new NotificationService.OnNotificationFailed(service_NotificationFailed);
service.NotificationSuccess += new NotificationService.OnNotificationSuccess(service_NotificationSuccess);
service.Connecting += new NotificationService.OnConnecting(service_Connecting);
service.Connected += new NotificationService.OnConnected(service_Connected);
service.Disconnected += new NotificationService.OnDisconnected(service_Disconnected);
PushMessage(token, message, service, 1, szHiddenMessage,tag);
}