AliSoftware / OHHTTPStubs

Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!
MIT License
5.03k stars 602 forks source link

Added fix for Xcode 12 - Warnings related to iOS 8 support (Cocoapods) #345

Closed runyonkj closed 2 years ago

runyonkj commented 3 years ago

Checklist

Description

Fix warnings generated by Xcode 12 related to iOS 8 support for users of the OHHTTPStubs cocoapod, similar to how PR https://github.com/AliSoftware/OHHTTPStubs/pull/328 addressed these same warnings for those using OHHTTPStubs with SPM.

Motivation and Context

This PR eliminates Xcode 12's warnings related to support of iOS 8 both for users of the pod, and for the OHHTTPStubs unit tests. I also fixed warnings about of the use of deprecated NSURLConnection method sendAsynchronousRequest by replacing them with NSURLSession dataTaskWithRequest, and disabled the deprecation warning for sendSynchronousRequest since the synchronous call is specifically required for the test.

I ran and passed all four unit test targets locally after the changes.

Note: I did NOT commit the changes to the generated Pods project file due to the large number of diffs. It appears it has not has updates committed for quite a while and is out of date. I could provide another PR that modernizes the project a bit, using Cocoapods 1.10.1 and AFNetworking 4.0.1 for best pod and SPM support with Xcode 12. I believe the update to AFNetworking would require changing the minimum deployment of OHHTTPStubs (at least internally) from macOS 10.9 to 10.10.

Final note: The only change required to eliminate these warnings for consumers of the pod are the two lines in the podspec. If desired, I can close this PR and open another with only that change. I just thought I'd go a little farther and fix the same warnings for the project itself.