I am working on an app that allows an user to create files and folders on the cloud from iPad.
When a file is deleted, the app automatically creates a 'Recycle Bin' folder on the cloud and puts that file in it. I have created NSOperationQueue
for all the operations i.e. I have separate queue for Folder Creation and a separate queue for File Upload. The problem that I am facing is that, the operation for file upload gets executed before the operation for folder creation is completed and so file doesn't gets uploaded successfully.
Can anyone help me to make the folder creation operation synchronous?
I have tried the following code
[create_folder_queue addOperations:[NSArray arrayWithObject:folderOperation] waitUntilFinished:YES];
but it doesn't execute the operation.
Thanks in advance.
If you want a synchronous queue, run the -setMaxConcurrentOperationCount:
method on your operation queue to set it to 1
.
After setting this property, you will only have at most one operation running at a time in the queue, which is more or less the definition of a synchronous queue, where one task only follows after another is complete.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With