Created
December 1, 2016 03:20
-
-
Save robertmryan/c2ff80356530c4ea2458671ebaba16c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Don't declare this `static`, as you never want to be tempted (or accidentally) refer to this static directly: | |
// | |
// static AFHTTPSessionManager *requestManager ; | |
@implementation Mysevers // this was the name you used | |
// always use this singleton | |
+ (AFHTTPSessionManager *)sharedHTTPSession { | |
static dispatch_once_t onceToken; | |
static AFHTTPSessionManager *requestManager; // instead, make it a local `static` | |
dispatch_once(&onceToken, ^{ | |
requestManager = [AFHTTPSessionManager manager]; | |
requestManager.requestSerializer.timeoutInterval = 10; | |
}); | |
return requestManager; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment