我已经在应用程序的委托方法中向服务器发送请求:(UIApplication *)application didReceiveRemoteNotification: 但是当多个推送通知同时出现时,应用程序会因为没有而崩溃。的请求转到服务器。
在委托方法中,我编写了以下代码:
if (!downloadInboxQueue) {
downloadInboxQueue = [[NSOperationQueue alloc] init];
downloadInboxQueue.maxConcurrentOperationCount=1;
}
NSNumber *ischatnumber=[[NSNumber alloc] initWithInt:0];
operationObject=[[Operation_Inbox alloc] init];
NSInvocationOperation *operation22= [[NSInvocationOperation alloc] initWithTarget:operationObject selector:@selector(getEventFromServer:) object:ischatnumber];
[downloadInboxQueue addOperation:operation22];
operation22=nil;
NSInvocationOperation *operation2= [[NSInvocationOperation alloc] initWithTarget:operationObject selector:@selector(getEventFromServer:) object:ischatnumber];
[downloadInboxQueue addOperation:operation2];
operation2=nil;
//getEventFromServer: 发送请求和获取响应的方法............
请建议我如何处理。
- 当多个推送通知到来时,调用了多少次委托方法?
- 发送 http 请求和获得响应之间需要多少时间(最长时间)?