dispatch_async question


Hi All,

In the following code, does it *need* to use the dispatch_async function?

dispatch_async(dispatch_get_main_queue(), ^{
if ([[self delegate] respondsToSelector:@selector(gameCenterManager:availabilityChanged:)])
[[self delegate] gameCenterManager:self availabilityChanged:successDictionary];

It sometimes uses it and sometimes it calls the delegate inline. I’m wondering why?

As far as I am aware, the only thing using dispatch_async does, is call the delegate sometime after the current method as returned, which I can’t see is of any benefit and makes things much hard to understand.

Am I missing something? This code is attempting to authenticate a Game Center Player, (the whole method is copied below), it may prompt the user to authenticate, I’m wondering if its something to do with this, although again, I can’t see that dispatch_async is necessary or or is of any benefit?

I’m trying to debug my Game Center Code and decided to see how someone else did it, but I’m getting more confused by the minute,

All the Best

Join cocoa@apple-dev.groups.io to automatically receive all group messages.