I'm binding an NSArrayController to a managedObjectContext with mainQueueConcurrency.
All that I want is to do is modify the sort properties the arrangedObjects with my own function and then call rearrangeObjects
and then select some objects.
But it's looking like rearrangeObjects
doesn't execute synchronously.
So how can I prove that, one way or the other?
This 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 the dispatch_async
, it doesn't work. The selection doesn't happen.
I'm fairly convinced that like fetch
on an NSArrayController, ** So how do I prove that? I can throw breakpoints in there and examine the array controller, etc etc. And I have, and I suspect that's what's happening.rearrangeObjects
is scheduling itself on the next runloop iteration.
But is there some debugging trick which would just make it obvious "Eureka! This line of code's launching an asynchronous operation" ??
** It was cocoa bindings that's doing something asynchronously. Of course. rearrangeObjects just triggers it.