0

我是 .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.

谢谢你,钱德拉。

4

0 回答 0