I have a long O operation, which is called through NSInvocationOperation, is scheduled by itself, adding it to NSOperationQueue so that it runs asynchronously. This lengthy O operation is called on two different occasions in my application.
In case A, operation O is called as a result of clicking on some widget in some representation. As soon as the widget is listened, the O operation has been working for a while (I see this thanks to the UIActivityIndicator), but it does not slow down or block the user interface, so I can use other widgets and perform other user interface operations while the O operation is working.
In case B, operation O is called as a result of receiving a local notification, in the case of delegating the delegate of the didReceiveLocalNotification method. In this case, the user interface operations that are performed immediately after the O operation is called, while still in the didReceiveLocalNotification method, are significantly slowed down, mainly to bypass, almost the same as if the O operation captured the processor.
Why is this so, and what would be the right way to invoke the O operation in case B so that it actually runs simultaneously in the background with a lower priority, leaving the rest of the code in the didReceiveLocalNotification method to run in normal speed mode?
NOTE. Operation O is combined with local notifications (deleting existing ones or scheduling new ones) and calendars (querying the event store for better planning of local notifications).
source
share