Skip to content

Commit 20ed64d

Browse files
committed
Updated README
1 parent dbce5ee commit 20ed64d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,10 @@ In general, `OHHTTPStubs` is automatically enabled by default, both for:
206206
* requests made using `NSURLConnection` or `[NSURLSession sharedSession]`;
207207
* requests made using a `NSURLSession` created using a `[NSURLSessionConfiguration defaultSessionConfiguration]` or `[NSURLSessionConfiguration ephemeralSessionConfiguration]` configuration (using `[NSURLSession sessionWithConfiguration:…]`-like methods).
208208

209-
> As all this automatic installation of `OHHTTPStubs` (registration of `OHHTTPStubs`'s private `NSURLProtocol` using `+[NSURLProtocol registerClass:]` + method swizzling to insert the same `NSURLProtocol` in the `NSURLSessionConfiguration` returned by the default constructors) is done in `+[OHHTTPStubs initialize]`, the `OHHTTPStubs` class must have been used at least once before creating your first `NSURLSessionConfiguration` or starting your first request
210-
211209
If you need to disable (and re-enable) `OHHTTPStubs` globally or per session, you can use:
212210

213211
* `[OHHTTPStubs setEnabled:]` for `NSURLConnection`/`[NSURLSession sharedSession]`-based requests
214-
* `[OHHTTPStubs setEnabled:forSessionConfiguration:]` for requests sent on a session created using `[NSURLSession sessionWithConfiguration:...]`
212+
* `[OHHTTPStubs setEnabled:forSessionConfiguration:]` for requests sent on a session created using `[NSURLSession sessionWithConfiguration:...]`. Note that you have to call this before creating the `NSURLSession` as the `NSURLSessionConfiguration` is deep-copied on the creation of the `NSURLSession` instance and cannot be modified afterwards.
215213

216214
_In practice, there is no need to ever explicitly call `setEnabled:` or `setEnabled:forSessionConfiguration:` using `YES`, as this is the default._
217215

0 commit comments

Comments
 (0)