apple push notification with APNS sharp

匆匆过客 提交于 2019-12-04 12:45:32

i found out the problem. it was error in APNS SHARP library thread workflow.

EDIT:
i am calling this method after queueing all the notification.
like
service.start();
and here is method

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

I am seeing this as well. Looking at the NotificationConnection.Close() method i found this:

// Sleep here to prevent a race condition // in which a notification could be queued while the worker thread // is sleeping after its loop, but if we set closing true within that 100 ms, // the queued notifications during that time would not get dequeued as the loop // would exit due to closing = true; // 250 ms should be ample time for the loop to dequeue any remaining notifications // after we stopped accepting above Thread.Sleep(250);

And in the loop mentioned i found: Thread.Sleep(500);

Setting the sleep time in the close method to 1000 fixed it for me ;) - answer from :http://code.google.com/p/apns-sharp/issues/detail?id=41

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!