From 0eec5e02958a4082b471cdc9493f85ebb2f9479d Mon Sep 17 00:00:00 2001 From: Josip Bernat Date: Tue, 18 Nov 2014 10:35:33 +0100 Subject: [PATCH] Added allowsInvalidCertificate for invalid https certificates --- JBMessage.podspec | 6 +++--- JBMessage.xcodeproj/project.pbxproj | 2 ++ JBMessage/JBMessage/JBMessage.h | 5 +++++ JBMessage/JBMessage/JBMessage.m | 4 ++++ Podfile | 2 +- Podfile.lock | 20 ++++++++++---------- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/JBMessage.podspec b/JBMessage.podspec index dc43994..ff8f78e 100644 --- a/JBMessage.podspec +++ b/JBMessage.podspec @@ -1,15 +1,15 @@ Pod::Spec.new do |s| s.name = "JBMessage" - s.version = "1.0.17" + s.version = "1.0.18" s.summary = "JBMessage is simple iOS networking wrapper based on AFNetworking" s.homepage = "https://github.com/josipbernat/JBMessage" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Josip Bernat" => "josip.bernat@gmail.com" } s.social_media_url = "http://twitter.com/josipbernat" s.platform = :ios, "6.0" - s.source = { :git => "https://github.com/josipbernat/JBMessage.git", :tag => "v1.0.17" } + s.source = { :git => "https://github.com/josipbernat/JBMessage.git", :tag => "v1.0.18" } s.source_files = 'JBMessage/JBMessage/**/*.{h,m}' s.requires_arc = true - s.dependency "AFNetworking", "~> 2.4" + s.dependency "AFNetworking", "~> 2.5" end diff --git a/JBMessage.xcodeproj/project.pbxproj b/JBMessage.xcodeproj/project.pbxproj index 49ea64d..85dc286 100644 --- a/JBMessage.xcodeproj/project.pbxproj +++ b/JBMessage.xcodeproj/project.pbxproj @@ -481,6 +481,7 @@ }; 1F3B320218E387DF000422F5 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = AA1E78719F2B7E60B0241EA5 /* Pods.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/JBMessage.app/JBMessage"; FRAMEWORK_SEARCH_PATHS = ( @@ -503,6 +504,7 @@ }; 1F3B320318E387DF000422F5 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4358A0A6A1532087BB87DD46 /* Pods.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/JBMessage.app/JBMessage"; FRAMEWORK_SEARCH_PATHS = ( diff --git a/JBMessage/JBMessage/JBMessage.h b/JBMessage/JBMessage/JBMessage.h index d81669e..392558b 100644 --- a/JBMessage/JBMessage/JBMessage.h +++ b/JBMessage/JBMessage/JBMessage.h @@ -115,6 +115,11 @@ typedef void (^JBDownloadBlock)(NSUInteger bytesRead, long long totalBytesRead, */ @property (nonatomic, readwrite) BOOL shouldContinueAsBackgroundTask; +/** + * Boolean value determening wheter operation should allow invalid (https) certificates. Default value is NO. + */ +@property (nonatomic, readwrite) BOOL allowsInvalidCertificates; + /** * A file URL for the multipart request. Deprecated from V.1.0.9. See inputFileURL and outputFileStreamPath. */ diff --git a/JBMessage/JBMessage/JBMessage.m b/JBMessage/JBMessage/JBMessage.m index d05b89b..5835bc1 100644 --- a/JBMessage/JBMessage/JBMessage.m +++ b/JBMessage/JBMessage/JBMessage.m @@ -259,6 +259,10 @@ - (void)executeRequest { NSURLRequest *request = [self urlRequest]; AFHTTPRequestOperationManager *manager = [self requestOperationManager]; + if (self.allowsInvalidCertificates) { + manager.securityPolicy.allowInvalidCertificates = YES; + } + __weak id this = self; AFHTTPRequestOperation *operation = [manager HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) { diff --git a/Podfile b/Podfile index 5ee268e..5ab10da 100644 --- a/Podfile +++ b/Podfile @@ -1,2 +1,2 @@ platform :ios, '6.0' -pod 'AFNetworking', '~> 2.4' +pod 'AFNetworking', '~> 2.5' diff --git a/Podfile.lock b/Podfile.lock index 1b76774..01bf69f 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,30 +1,30 @@ PODS: - - AFNetworking (2.4.1): + - AFNetworking (2.5.0): - AFNetworking/NSURLConnection - AFNetworking/NSURLSession - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - AFNetworking/UIKit - - AFNetworking/NSURLConnection (2.4.1): + - AFNetworking/NSURLConnection (2.5.0): - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - - AFNetworking/NSURLSession (2.4.1): + - AFNetworking/NSURLSession (2.5.0): - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - - AFNetworking/Reachability (2.4.1) - - AFNetworking/Security (2.4.1) - - AFNetworking/Serialization (2.4.1) - - AFNetworking/UIKit (2.4.1): + - AFNetworking/Reachability (2.5.0) + - AFNetworking/Security (2.5.0) + - AFNetworking/Serialization (2.5.0) + - AFNetworking/UIKit (2.5.0): - AFNetworking/NSURLConnection - AFNetworking/NSURLSession DEPENDENCIES: - - AFNetworking (~> 2.4) + - AFNetworking (~> 2.5) SPEC CHECKSUMS: - AFNetworking: 0aabc6fae66d6e5d039eeb21c315843c7aae51ab + AFNetworking: 0f54cb5d16ce38c1b76948faffb8d5fb705021c7 -COCOAPODS: 0.34.1 +COCOAPODS: 0.34.4