月亮APNS;数组可能不为空或为空。参数名称:rawData

时间:2013-09-23 09:58:57

标签: c# .net moonapns

我是.net编码新手。现在我正在尝试实现Moon apns以向我的iphone应用程序之一发送通知。当我在本地运行应用程序(没有托管)它工作正常,我能够向ios应用程序发送推送通知。我交叉检查它并且工作得很好。但在将其托管在服务器(没有防火墙)后,我收到以下错误。我无法理解我做错了什么。我的代码如下,我得到例外,如 “数组可能不为空或为空。参数名称:rawData”

代码:

string message = string.Format("{0} has sent you a text chirp", username);
var payload1 = new NotificationPayload(token, message, int.Parse(badgeNumber), "default");
payload1.AddCustom("MessageType", "MessageTypeText");
payload1.AddCustom("Sender", toFbID);
payload1.AddCustom("AlertMessage", message);
payload1.AddCustom("MessageID", msgid);

var p = new List<NotificationPayload> { payload1 };

push = new PushNotification(true, "aps_development.p12", "chrip");

var rejected = push.SendToApple(p);
foreach (var item in rejected)
{
    contxt.Response.Write(item);
}

有人可以帮忙吗?我尝试使用开发和生产p12文件但没有用。

编辑:

记录信息:

  20130923 1538 - Info - Payload queue received.
  20130923 1538 - Info - Connecting to apple server.
  20130923 1538 - Info - Creating SSL connection.
  20130923 1538 - Info - Conected.
  20130923 1538 - Error - An error occurred while reading Apple response for token       fb8a5834e2921f717ac83ce4ecdfd651922bbf81340bc133776bd55772fe6269 - Input string was not in a correct format.
  20130923 1538 - Info - Payload generated for fb8a5834e2921f717ac83ce4ecdfd651922bbf81340bc133776bd55772fe6269 : {"aps":{"alert":"hiiiiiiiiiii","badge":123}}
  20130923 1538 - Info - Notification successfully sent to APNS server for Device Toekn : fb8a5834e2921f717ac83ce4ecdfd789452bbf81340bc133776bd55772fe6269
  20130923 1538 - Info - Disconnected.

谢谢你, 钱德拉。

0 个答案:

没有答案