From 11a33db6bce67dd2b1139251fd1a349642ce65eb Mon Sep 17 00:00:00 2001 From: Paul Nicholson Date: Wed, 13 Apr 2016 15:40:24 -0400 Subject: [PATCH 1/2] Update request code to use afnetworking 3.0 api. --- BlockRSSParser.podspec | 10 +++++----- RSSParser/RSSParser.m | 34 ++++++++++++++++------------------ 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/BlockRSSParser.podspec b/BlockRSSParser.podspec index ee5d8a4..cac2001 100644 --- a/BlockRSSParser.podspec +++ b/BlockRSSParser.podspec @@ -1,21 +1,21 @@ Pod::Spec.new do |s| s.name = "BlockRSSParser" - s.version = "2.1" - s.summary = "AFNetworkingXMLRequestOperation based RSS parser." + s.version = "3.0" + s.summary = "AFNetworking based RSS parser." s.homepage = "https://github.com/tibo/BlockRSSParser" s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Thibaut LE LEVIER" => "thibaut@lelevier.fr" } - s.source = { :git => "https://github.com/tibo/BlockRSSParser.git", :tag => "2.1" } + s.source = { :git => "https://github.com/tibo/BlockRSSParser.git", :tag => "3.0" } s.requires_arc = true s.platform = :ios - s.ios.deployment_target = '6.0' + s.ios.deployment_target = '7.0' s.source_files = 'Classes', 'RSSParser/*.{h,m}' - s.dependency 'AFNetworking', '~> 2.0' + s.dependency 'AFNetworking', '~> 3.0' end diff --git a/RSSParser/RSSParser.m b/RSSParser/RSSParser.m index 09003c6..b05bac4 100644 --- a/RSSParser/RSSParser.m +++ b/RSSParser/RSSParser.m @@ -7,8 +7,7 @@ // #import "RSSParser.h" - -#import "AFHTTPRequestOperation.h" +#import "AFHTTPSessionManager.h" #import "AFURLResponseSerialization.h" @interface RSSParser() @@ -52,22 +51,21 @@ - (void)parseRSSFeedForRequest:(NSURLRequest *)urlRequest block = [success copy]; - AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; - - operation.responseSerializer = [[AFXMLParserResponseSerializer alloc] init]; - operation.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/xml", @"text/xml",@"application/rss+xml", @"application/atom+xml", nil]; - - [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { - failblock = [failure copy]; - [(NSXMLParser *)responseObject setDelegate:self]; - [(NSXMLParser *)responseObject parse]; - } - failure:^(AFHTTPRequestOperation *operation, NSError *error) { - failure(error); - }]; - - [operation start]; - + AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; + manager.responseSerializer = [AFXMLParserResponseSerializer serializer]; + manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/xml", @"text/xml",@"application/rss+xml", @"application/atom+xml", nil]; + NSURLSessionDataTask *task = [manager dataTaskWithRequest:urlRequest uploadProgress:nil downloadProgress:nil + completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) { + if (error) { + if (failure) failure(error); + } else { + if (success) { + [(NSXMLParser *)responseObject setDelegate:self]; + [(NSXMLParser *)responseObject parse]; + } + } + }]; + [task resume]; } #pragma mark - From bc527d3ea0b321ad3c6f9c033a1f970fd4f74ac1 Mon Sep 17 00:00:00 2001 From: Paul Nicholson Date: Wed, 13 Apr 2016 15:42:25 -0400 Subject: [PATCH 2/2] Update sample project. Use latest Xcode project recommendations. Add exception for NSAppTransportSecurity. Use afnetworking 3.0. --- RSSParser_Sample/Podfile | 2 +- RSSParser_Sample/Podfile.lock | 35 ++++----- .../project.pbxproj | 74 ++++++++++++++----- .../xcschemes/RSSParser_Sample.xcscheme | 18 +++-- .../RSSParser_Sample-Info.plist | 7 +- RSSParser_Sample/Tests/Tests-Info.plist | 2 +- 6 files changed, 93 insertions(+), 45 deletions(-) diff --git a/RSSParser_Sample/Podfile b/RSSParser_Sample/Podfile index 2cf8cab..e4ded38 100644 --- a/RSSParser_Sample/Podfile +++ b/RSSParser_Sample/Podfile @@ -1,5 +1,5 @@ platform :ios, '7.0' -pod 'AFNetworking', '~> 2.0.3' +pod 'AFNetworking', '~> 3.0' target :Tests, :exclusive => true do pod 'Kiwi/XCTest' diff --git a/RSSParser_Sample/Podfile.lock b/RSSParser_Sample/Podfile.lock index ecc3784..3ee271d 100644 --- a/RSSParser_Sample/Podfile.lock +++ b/RSSParser_Sample/Podfile.lock @@ -1,22 +1,19 @@ PODS: - - AFNetworking (2.0.3): - - AFNetworking/NSURLConnection - - AFNetworking/NSURLSession + - AFNetworking (3.1.0): + - AFNetworking/NSURLSession (= 3.1.0) + - AFNetworking/Reachability (= 3.1.0) + - AFNetworking/Security (= 3.1.0) + - AFNetworking/Serialization (= 3.1.0) + - AFNetworking/UIKit (= 3.1.0) + - AFNetworking/NSURLSession (3.1.0): - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - - AFNetworking/UIKit - - AFNetworking/NSURLConnection (2.0.3): - - AFNetworking/Reachability - - AFNetworking/Security - - AFNetworking/Serialization - - AFNetworking/NSURLSession (2.0.3): - - AFNetworking/NSURLConnection - - AFNetworking/Reachability (2.0.3) - - AFNetworking/Security (2.0.3) - - AFNetworking/Serialization (2.0.3) - - AFNetworking/UIKit (2.0.3): - - AFNetworking/NSURLConnection + - AFNetworking/Reachability (3.1.0) + - AFNetworking/Security (3.1.0) + - AFNetworking/Serialization (3.1.0) + - AFNetworking/UIKit (3.1.0): + - AFNetworking/NSURLSession - Kiwi/ARC (2.2.3) - Kiwi/NonARC (2.2.3) - Kiwi/XCTest (2.2.3): @@ -24,11 +21,11 @@ PODS: - Kiwi/NonARC DEPENDENCIES: - - AFNetworking (~> 2.0.3) + - AFNetworking (~> 3.0) - Kiwi/XCTest SPEC CHECKSUMS: - AFNetworking: e499052cbf3d743e9bb727bb37adb9dc2547ba15 - Kiwi: 04c51e880831d291748ec702d42c4101f7eb95c9 + AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67 + Kiwi: e4e2673e9435622a5b84149fc90394b5345bc8bc -COCOAPODS: 0.28.0 +COCOAPODS: 0.35.0 diff --git a/RSSParser_Sample/RSSParser_Sample.xcodeproj/project.pbxproj b/RSSParser_Sample/RSSParser_Sample.xcodeproj/project.pbxproj index f84eb33..b8a066b 100644 --- a/RSSParser_Sample/RSSParser_Sample.xcodeproj/project.pbxproj +++ b/RSSParser_Sample/RSSParser_Sample.xcodeproj/project.pbxproj @@ -45,7 +45,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 073191F44E634D718281FECB /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = ""; }; 110A8A8314E9A30C0013AC07 /* RSSParser_Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RSSParser_Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 110A8A8714E9A30C0013AC07 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 110A8A8914E9A30C0013AC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -81,7 +80,10 @@ 118543F314E9AFE0001761CB /* ArticleDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ArticleDetailViewController.xib; sourceTree = ""; }; 2491A17B4E26435E940E1404 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4A5D50FCF4044DC3865DCB53 /* libPods-Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - CB8EEF26B88147498AFADEE2 /* Pods-Tests.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.xcconfig"; path = "Pods/Pods-Tests.xcconfig"; sourceTree = ""; }; + 57367787D398B56F08A3E2D9 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; + 75EAD02B816777CFF768A4F6 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + C9BAC420E574DCEFDA7C6A58 /* Pods-Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig"; sourceTree = ""; }; + D61CB0B4B599B1FA028DAC44 /* Pods-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig"; sourceTree = ""; }; DA0619AC16A3127300DB4BB8 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; DA0619AE16A312E200DB4BB8 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -127,8 +129,7 @@ 113DA6AA18452BF5005700B7 /* Tests */, 110A8A8614E9A30C0013AC07 /* Frameworks */, 110A8A8414E9A30C0013AC07 /* Products */, - 073191F44E634D718281FECB /* Pods.xcconfig */, - CB8EEF26B88147498AFADEE2 /* Pods-Tests.xcconfig */, + DE10F21BD2479F8FC96EA5A3 /* Pods */, ); sourceTree = ""; }; @@ -224,6 +225,17 @@ path = ../RSSParser; sourceTree = ""; }; + DE10F21BD2479F8FC96EA5A3 /* Pods */ = { + isa = PBXGroup; + children = ( + 57367787D398B56F08A3E2D9 /* Pods.debug.xcconfig */, + 75EAD02B816777CFF768A4F6 /* Pods.release.xcconfig */, + C9BAC420E574DCEFDA7C6A58 /* Pods-Tests.debug.xcconfig */, + D61CB0B4B599B1FA028DAC44 /* Pods-Tests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -272,7 +284,7 @@ 110A8A7A14E9A30A0013AC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0420; + LastUpgradeCheck = 0730; TargetAttributes = { 113DA6A418452BF4005700B7 = { TestTargetID = 110A8A8214E9A30B0013AC07; @@ -350,7 +362,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Pods-Tests-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-resources.sh\"\n"; showEnvVarsInLog = 0; }; 9B69B36826794FA0AC47656A /* Check Pods Manifest.lock */ = { @@ -380,7 +392,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -441,12 +453,21 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -454,10 +475,15 @@ ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; @@ -466,16 +492,28 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; @@ -484,12 +522,13 @@ }; 110A8A9C14E9A30C0013AC07 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 073191F44E634D718281FECB /* Pods.xcconfig */; + baseConfigurationReference = 57367787D398B56F08A3E2D9 /* Pods.debug.xcconfig */; buildSettings = { GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "RSSParser_Sample/RSSParser_Sample-Prefix.pch"; INFOPLIST_FILE = "RSSParser_Sample/RSSParser_Sample-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.lelevier.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -497,12 +536,13 @@ }; 110A8A9D14E9A30C0013AC07 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 073191F44E634D718281FECB /* Pods.xcconfig */; + baseConfigurationReference = 75EAD02B816777CFF768A4F6 /* Pods.release.xcconfig */; buildSettings = { GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "RSSParser_Sample/RSSParser_Sample-Prefix.pch"; INFOPLIST_FILE = "RSSParser_Sample/RSSParser_Sample-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.lelevier.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -510,9 +550,8 @@ }; 113DA6B518452BF5005700B7 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = CB8EEF26B88147498AFADEE2 /* Pods-Tests.xcconfig */; + baseConfigurationReference = C9BAC420E574DCEFDA7C6A58 /* Pods-Tests.debug.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/RSSParser_Sample.app/RSSParser_Sample"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -544,6 +583,7 @@ INFOPLIST_FILE = "Tests/Tests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.lelevier.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = xctest; @@ -552,9 +592,8 @@ }; 113DA6B618452BF5005700B7 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = CB8EEF26B88147498AFADEE2 /* Pods-Tests.xcconfig */; + baseConfigurationReference = D61CB0B4B599B1FA028DAC44 /* Pods-Tests.release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/RSSParser_Sample.app/RSSParser_Sample"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -582,6 +621,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; INFOPLIST_FILE = "Tests/Tests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.lelevier.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = xctest; diff --git a/RSSParser_Sample/RSSParser_Sample.xcodeproj/xcshareddata/xcschemes/RSSParser_Sample.xcscheme b/RSSParser_Sample/RSSParser_Sample.xcodeproj/xcshareddata/xcschemes/RSSParser_Sample.xcscheme index a31f6a3..59d2c03 100644 --- a/RSSParser_Sample/RSSParser_Sample.xcodeproj/xcshareddata/xcschemes/RSSParser_Sample.xcscheme +++ b/RSSParser_Sample/RSSParser_Sample.xcodeproj/xcshareddata/xcschemes/RSSParser_Sample.xcscheme @@ -1,5 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -47,17 +48,21 @@ ReferencedContainer = "container:RSSParser_Sample.xcodeproj"> + + - + - + CFBundleIconFiles CFBundleIdentifier - com.lelevier.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -30,6 +30,11 @@ armv7 + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/RSSParser_Sample/Tests/Tests-Info.plist b/RSSParser_Sample/Tests/Tests-Info.plist index 06f86c9..169b6f7 100644 --- a/RSSParser_Sample/Tests/Tests-Info.plist +++ b/RSSParser_Sample/Tests/Tests-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.lelevier.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType