How to determine if Apple methods are asynchronous?

I am binding NSArrayController to managedObjectContext with mainQueueConcurrency.

All I want to do is change the sort properties of the stacked objects using my own function, and then call rearrangeObjects and then select some objects.

But it looks like rearrangeObjects not running synchronously.

So how can I prove it, anyway?

It works:

 [self.myArrayController rearrangeObjects]; // Async needed -- I believe rearrange calls a fetch, which is async dispatch_async(dispatch_get_main_queue(), ^{ [self.myArrayController setSelectedObjects:anArray]; }); 

Minus dispatch_async , it does not work. The choice does not occur.

I am pretty convinced that, like fetch in NSArrayController, rearrangeObjects plans itself for the next iteration of runloop. ** So how can I prove this? I can throw breakpoints there and examine the array controller, etc. And I have, and I suspect what is happening.

But is there some kind of debugging trick that will just make it obvious "Eureka! This line of code starts the asynchronous operation"

** These were cocoa bindings that did something asynchronously. Sure. backrangeObjects just starts it.

+4
source share
1 answer

I managed to catch the rearrangeObjects dispatch_async_f call (via bindings) by breaking just before the suspicious line of code and turning on symbolic breakpoints in the dispatch_async GCD functions:

symbolic breakpoints on dispatch_async *

And, of course, the dispatch_async_f symbolic breakpoint stopped at the rearrangeObjects line:

breakpoint activated on rearrangeObjects

+2
source

Source: https://habr.com/ru/post/979212/


All Articles