You may consider using -[AFURLSessionManager tasks] since it does the same for you using semaphore-based approach.