To block the execution of the main thread until the operation completes, you could do [operation waitUntilFinished]
after it's added to the operation queue. In this case, you wouldn't need the return
in the block; setting the __block
variable would be enough.
That said, I'd strongly discourage forcing asynchronous operations to synchronous methods. It's tricky to get your head around sometimes, but if there's any way you could structure this to be asynchronous, that would almost certainly be the way to go.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…