A minimal category that adds synchronous request support to AFNetworking 1.x, 2.x, and 3.x.
AFNetworking-Synchronous is an Objective-C category that adds synchronous HTTP request capabilities to the AFNetworking library. It solves the problem of needing blocking network operations in situations where asynchronous design isn't practical, such as when working with document architectures or other frameworks that handle threading internally and expect synchronous results.
iOS and macOS developers using AFNetworking who need synchronous network requests for specific use cases where asynchronous patterns aren't feasible, particularly those working with frameworks that manage their own threading.
Developers choose AFNetworking-Synchronous because it provides a safe, well-tested way to perform synchronous requests with AFNetworking while avoiding common deadlock scenarios. It offers cross-version compatibility and clear guidance about proper usage, making it more reliable than implementing synchronous wrappers manually.
Synchronous requests for AFNetworking 1.x, 2.x, and 3.x
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports AFNetworking 1.x through 4.x with separate module imports, as shown in the podfile examples for each version.
Overrides default success and failure queues to prevent deadlocks, with clear code snippets for setting a separate completionQueue.
Explicitly advises against synchronous requests on the main thread and provides guidance to avoid crashes, as emphasized in the README.
Does not work with AFImageRequestOperation's processingBlock or custom subclasses that have asynchronous completion handlers, requiring a separate branch (using-completion-blocks).
Cannot be safely used on the main thread due to potential deadlocks and app termination risks, limiting its use in UI-heavy applications.
Despite safeguards, improper queue configuration can still cause deadlocks, as noted in the discussion about not setting the invoking queue as the processing queue.