A. We have done these 2 things for order of callbacks , We have maintained dictionary taskId, data format . This is the dictionary that gets filled during DidReceiveData (NSUrlSession session, NSUrlSessionDataTask dataTask, NSData data) callbacks . So the data gets filled in appropriately.
We set TaskDescription on each task added to NSUrlSession. We set it with endpoint name.
string strTaskDescription = strEndPointName;
getRequestTask.TaskDescription = strTaskDescription;
So inside DidCompleteWithError(NSUrlSession session, NSUrlSessionTask task, NSError error) we again check the taskdescrition and come to know about the endpoint name. The data for taskidentifier( key) is also retrieved.
B. The only concern that we have is about usage of NSOperationQueue set for NSURLSession. If its maximumConcurrentOperations is not set to 1 then the dictionary (specified in pont A above) will get accessed by multiple concurrent tasks( operations) . Will its usage get synchronized automatically ?