nsoperationqueue

NSOperation with dependency on another operation on a different queue does not start

烂漫一生 提交于 2021-02-09 14:35:10
问题 I have dependency graph of operations and I use multiple queues to organize various streams of operations. E.g. peopleQueue, sitesQueue, sessionQueue sessionQueue: loginOp, fetchUpdatedAccountOp peopleQueue: mostFrequentlyManagedClientsOp, remainingClientsOp sitesQueue: mostFrequentlyAccessedSitesOp, remainingSitesOp dependencies: *all* -> loginOp remainingClientsOp -> mostFrequentlyManagedClientsOp remainingSitesOp -> mostFrequentlyAccessedSitesOp The current setup works: after login

NSOperation with dependency on another operation on a different queue does not start

心不动则不痛 提交于 2021-02-09 14:34:33
问题 I have dependency graph of operations and I use multiple queues to organize various streams of operations. E.g. peopleQueue, sitesQueue, sessionQueue sessionQueue: loginOp, fetchUpdatedAccountOp peopleQueue: mostFrequentlyManagedClientsOp, remainingClientsOp sitesQueue: mostFrequentlyAccessedSitesOp, remainingSitesOp dependencies: *all* -> loginOp remainingClientsOp -> mostFrequentlyManagedClientsOp remainingSitesOp -> mostFrequentlyAccessedSitesOp The current setup works: after login

Operation Queue not executing in order even after setting priority and dependency on Operations

血红的双手。 提交于 2021-02-07 19:42:28
问题 I am making three api calls and want that API1 should execute first, once completed API2 should execute followed by API3. I used operation queue for this with adding dependency over operations. I tried setting priority as well but not getting api calls in order. Help me out how to make it properly. Code is like this : let op1 = Operation() op1.completionBlock = { self.APICall(urlString: self.url1) } op1.queuePriority = .veryHigh let op2 = Operation() op2.completionBlock = { self.APICall

Operation Queue not executing in order even after setting priority and dependency on Operations

守給你的承諾、 提交于 2021-02-07 19:42:12
问题 I am making three api calls and want that API1 should execute first, once completed API2 should execute followed by API3. I used operation queue for this with adding dependency over operations. I tried setting priority as well but not getting api calls in order. Help me out how to make it properly. Code is like this : let op1 = Operation() op1.completionBlock = { self.APICall(urlString: self.url1) } op1.queuePriority = .veryHigh let op2 = Operation() op2.completionBlock = { self.APICall

How to wait for all tasks of an NSURLSession to complete?

醉酒当歌 提交于 2020-06-16 07:48:37
问题 Why is NSURLSession operation queue empty after creating and resuming an NSURLSessionTask? Is there a way to tell if an NSURLSession has tasks pending? The goal is to wait for multiple tasks to complete, but this doesn't work: NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithStreamedRequest:request]; [uploadTask resume]; // this prints "0" NSLog(self.session.delegateQueue.operationCount) // this returns immediately instead of waiting for task to complete [self.session

PDFKit background search

你。 提交于 2020-06-12 15:53:04
问题 I'm trying to run a search on a background thread using new iOS PDFKit framework. override func main() { if isCancelled { return } pdfDocument = PDFDocument.init(url: book.document.url)! pdfDocument.delegate = self pdfDocument.beginFindString("test", withOptions: [.caseInsensitive, .diacriticInsensitive]) (async) //pdfDocument.findString("test", withOptions: [.caseInsensitive, .diacriticInsensitive]) (sync) } The problem is that none of the PDFDocumentDelegate's methods isn't called and if I