How can I make NSOperationQueue synchronous? I did tried this by subclassing NSOperation and setting "setMaxConcurrentOperationCount" to 1. And also adding dependencies on previous operations using "addDependency" method.
Adding Code:
if(!operationQueue)
{
operationQueue = [[MyQueue alloc] init];
}
[operationQueue setMaxConcurrentOperationCount:1];
UploadFileOperation *uploadFileOperation = [[UploadFileOperation alloc] initWithObject:someObject];
[operationQueue addOperation:uploadFileOperation];
Now when log the upload progress for two files it shows that both the files are uploading at the same time. Like this: File1 - 17.647026% Uploaded File1 - 18.352907% Uploaded File2 - 0.870381% Uploaded File2 - 1.740762% Uploaded File2 - 2.611142% Uploaded File2 - 3.481523% Uploaded File1 - 19.058788% Uploaded
Aucun commentaire:
Enregistrer un commentaire