苹果推送通知与APNS锐利

我使用APNS Sharp库进行苹果推送通知。 我从这里下载了 .i使用APNS sharp库提供的样本测试程序,没有任何修改。
它只是在我在该行代码处放置断点之前不发送任何通知。 如果我提出突破点。 我只是工作正常。这是预期的行为,或者我做错了什么。 而且我也没有任何例外。 谢谢你的帮助。 这是代码

static void Main(string[] args) { bool sandbox = true; string testDeviceToken = "Token"; string p12File = "apn_developer_identity.p12"; string p12FilePassword = "yourpassword"; int sleepBetweenNotifications = 15000; string p12Filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, p12File); NotificationService service = new NotificationService(sandbox, p12Filename, p12FilePassword, 1); service.SendRetries = 5; service.ReconnectDelay = 5000; //5 seconds 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); Notification alertNotification = new Notification(testDeviceToken); alertNotification.Payload.Alert.Body = "Testing {0}..."; alertNotification.Payload.Sound = "default"; alertNotification.Payload.Badge = i; if (service.QueueNotification(alertNotification)) Console.WriteLine("Notification Queued!"); else Console.WriteLine("Notification Failed to be Queued!"); Console.WriteLine("Cleaning Up..."); service.Close();// if i dont put a break point in here, it simply does not send any notification service.Dispose(); } 

我希望我的问题很明确……
更新:我被困在这里。任何人都可以帮助我。

我发现了问题。 这是APNS SHARP库线程工作流程中的错误。

编辑:
我在排队所有通知后调用此方法。
喜欢
service.start();
这是方法

  public void Send() { foreach (NotificationConnection conn in this.notificationConnections) { // Console.Write("Start Sending"); conn.start(P12File, P12FilePassword); } } 

我也看到了这一点。 看看NotificationConnection.Close()方法我发现了这个:

//在这里睡觉以防止竞争条件//当工作线程//在其循环之后hibernate时,通知可以排队,但是如果我们在100毫秒内设置关闭为真,那么在此期间排队的通知将会由于关闭= true,因为循环//将退出而不会出列; //在我们停止接受上面的Thread.Sleep(250)之后// 250 ms应该有充足的时间让循环出现任何剩余的通知//

在提到的循环中我发现:Thread.Sleep(500);

将close方法中的睡眠时间设置为1000可以为我修复;) – 回答:http://code.google.com/p/apns-sharp/issues/detail?id = 41