我很難搞清楚如何從我的服務器向APNS發送消息。我已經使用了Moon-APNS和APNS-Sharp,並且我陷入了「參數不正確」的錯誤。我使用KeyChain生成了p12文件。我將文件拖入我的Win 7虛擬環境,並將其放入bin \ debug文件夾中。以下是Moon-APNS的代碼:使用Moon-APNS或APNS-Sharp的Apple推送通知
static void Main(string[] args)
{
var deviceToken = "21212d6fefebde4d317cab41afff65631b5a4d47e5d85da305ec610b4013e616";
var payload = new NotificationPayload(deviceToken, "hello world");
var notificationList = new List<NotificationPayload>() { payload };
var push = new PushNotification(true, "PushNotificationTest.p12", "pushchat");
var result = push.SendToApple(notificationList);
Console.WriteLine("Hello World");
}
任何人有想法嗎?
我通過使用openssl方法而不是使用KeyChain生成.p12文件來解決我的問題。這裏是我遵循的鏈接:http://code.google.com/p/apns-sharp/wiki/HowToCreatePKCS12Certificate – azamsharp