Commit 89cdb7fb authored by Felix Paul Kühne's avatar Felix Paul Kühne

MDFMovieDBSessionManager: fix runtime exceptions

parent 346389ca
......@@ -25,7 +25,13 @@
#import "AFNetworking.h"
static NSString * const MovieDBBaseURLString = @"https://api.themoviedb.org/3/";
static AFHTTPSessionManager *_sharedClient = nil;
static MDFMovieDBSessionManager *_sharedManager;
@interface MDFMovieDBSessionManager ()
@property (retain) AFHTTPSessionManager *sharedClient;;
@end
@implementation MDFMovieDBSessionManager
......@@ -33,16 +39,18 @@ static AFHTTPSessionManager *_sharedClient = nil;
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedClient = [[AFHTTPSessionManager alloc] initWithBaseURL:[NSURL URLWithString:MovieDBBaseURLString]];
_sharedClient.requestSerializer = [AFJSONRequestSerializer serializer];
_sharedManager = [[MDFMovieDBSessionManager alloc] init];
_sharedManager.sharedClient = [[AFHTTPSessionManager alloc] initWithBaseURL:[NSURL URLWithString:MovieDBBaseURLString]];
_sharedManager.sharedClient.requestSerializer = [AFJSONRequestSerializer serializer];
AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
securityPolicy.validatesDomainName = NO;
securityPolicy.allowInvalidCertificates = YES;
_sharedClient.securityPolicy = securityPolicy;
_sharedManager.sharedClient.securityPolicy = securityPolicy;
});
return (MDFMovieDBSessionManager *)_sharedClient;
return _sharedManager;
}
- (NSString *)description
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment