Skip to content

Instantly share code, notes, and snippets.

@robertmryan
Created December 1, 2016 03:20
Show Gist options
  • Save robertmryan/c2ff80356530c4ea2458671ebaba16c7 to your computer and use it in GitHub Desktop.
Save robertmryan/c2ff80356530c4ea2458671ebaba16c7 to your computer and use it in GitHub Desktop.
// 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