├── .gitignore ├── LICENSE ├── Podfile ├── Podfile.lock ├── PromiseKit+AFNetworking.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── soulstorm.xcuserdatad │ └── xcschemes │ ├── PromiseKit+AFNetworking.xcscheme │ └── xcschememanagement.plist ├── PromiseKit+AFNetworking ├── AFNetworking+PromiseKit.h ├── AFNetworking+PromiseKit.m ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── Main.storyboard ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── PromiseKit+AFNetworking-Bridging-Header.h ├── PromiseKit+AFNetworking-Info.plist ├── PromiseKit+AFNetworking-Prefix.pch ├── ViewController.h ├── ViewController.m ├── en.lproj │ └── InfoPlist.strings └── main.m ├── PromiseKit+AFNetworkingTests ├── AFHTTPRequestOperation+PromiseTests.m ├── HTTPClient+PromiseKitTests.m ├── PromiseKit+AFNetworkingTests-Info.plist ├── TestCommon.h └── en.lproj │ └── InfoPlist.strings ├── PromiseKit-AFNetworking.podspec └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | Pods/Target Support Files/Pods 2 | Pods 3 | .idea 4 | PromiseKit+AFNetworking.xcodeproj/project.xcworkspace/xcshareddata/PromiseKit+AFNetworking.xccheckout 5 | PromiseKit+AFNetworking.xcworkspace/xcshareddata/PromiseKit+AFNetworking.xccheckout 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Christos Sotiriou 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | use_frameworks! 3 | 4 | target 'PromiseKit+AFNetworking' do 5 | 6 | pod 'AFNetworking', '~> 3.2' 7 | pod 'PromiseKit', '~> 6.5' 8 | 9 | end 10 | 11 | target 'Tests' do 12 | pod 'Expecta', '~> 0.2.4' 13 | end 14 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (3.2.1): 3 | - AFNetworking/NSURLSession (= 3.2.1) 4 | - AFNetworking/Reachability (= 3.2.1) 5 | - AFNetworking/Security (= 3.2.1) 6 | - AFNetworking/Serialization (= 3.2.1) 7 | - AFNetworking/UIKit (= 3.2.1) 8 | - AFNetworking/NSURLSession (3.2.1): 9 | - AFNetworking/Reachability 10 | - AFNetworking/Security 11 | - AFNetworking/Serialization 12 | - AFNetworking/Reachability (3.2.1) 13 | - AFNetworking/Security (3.2.1) 14 | - AFNetworking/Serialization (3.2.1) 15 | - AFNetworking/UIKit (3.2.1): 16 | - AFNetworking/NSURLSession 17 | - Expecta (0.2.4) 18 | - PromiseKit (6.5.2): 19 | - PromiseKit/CorePromise (= 6.5.2) 20 | - PromiseKit/Foundation (= 6.5.2) 21 | - PromiseKit/UIKit (= 6.5.2) 22 | - PromiseKit/CorePromise (6.5.2) 23 | - PromiseKit/Foundation (6.5.2): 24 | - PromiseKit/CorePromise 25 | - PromiseKit/UIKit (6.5.2): 26 | - PromiseKit/CorePromise 27 | 28 | DEPENDENCIES: 29 | - AFNetworking (~> 3.2) 30 | - Expecta (~> 0.2.4) 31 | - PromiseKit (~> 6.5) 32 | 33 | SPEC REPOS: 34 | https://github.com/cocoapods/specs.git: 35 | - AFNetworking 36 | - Expecta 37 | - PromiseKit 38 | 39 | SPEC CHECKSUMS: 40 | AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057 41 | Expecta: cfaf1d3e2e194ca704a25e997093d30a1ce70b61 42 | PromiseKit: 27c1601bfb73405871b805bcb8cf7e55c4dad3db 43 | 44 | PODFILE CHECKSUM: bbbd5c94207152b68cd990c4a3948ea06303a092 45 | 46 | COCOAPODS: 1.7.5 47 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 06559D4619F5927F00EE7DE5 /* AFNetworking+PromiseKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 06B81A8D19F3F18C00A8CF14 /* AFNetworking+PromiseKit.m */; }; 11 | 06559D4A19F5A45E00EE7DE5 /* HTTPClient+PromiseKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 06559D4919F5A45E00EE7DE5 /* HTTPClient+PromiseKitTests.m */; }; 12 | 0666CC6E192961BC00110C1B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0666CC6D192961BC00110C1B /* Foundation.framework */; }; 13 | 0666CC70192961BC00110C1B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0666CC6F192961BC00110C1B /* CoreGraphics.framework */; }; 14 | 0666CC72192961BC00110C1B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0666CC71192961BC00110C1B /* UIKit.framework */; }; 15 | 0666CC78192961BC00110C1B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0666CC76192961BC00110C1B /* InfoPlist.strings */; }; 16 | 0666CC7A192961BC00110C1B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0666CC79192961BC00110C1B /* main.m */; }; 17 | 0666CC7E192961BC00110C1B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0666CC7D192961BC00110C1B /* AppDelegate.m */; }; 18 | 0666CC81192961BC00110C1B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0666CC7F192961BC00110C1B /* Main.storyboard */; }; 19 | 0666CC84192961BC00110C1B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0666CC83192961BC00110C1B /* ViewController.m */; }; 20 | 0666CC86192961BC00110C1B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0666CC85192961BC00110C1B /* Images.xcassets */; }; 21 | 0666CC8D192961BC00110C1B /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0666CC8C192961BC00110C1B /* XCTest.framework */; }; 22 | 0666CC8E192961BC00110C1B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0666CC6D192961BC00110C1B /* Foundation.framework */; }; 23 | 0666CC8F192961BC00110C1B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0666CC71192961BC00110C1B /* UIKit.framework */; }; 24 | 0666CC97192961BC00110C1B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0666CC95192961BC00110C1B /* InfoPlist.strings */; }; 25 | 0666CC99192961BC00110C1B /* AFHTTPRequestOperation+PromiseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0666CC98192961BC00110C1B /* AFHTTPRequestOperation+PromiseTests.m */; }; 26 | 06B81A8E19F3F18C00A8CF14 /* AFNetworking+PromiseKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 06B81A8D19F3F18C00A8CF14 /* AFNetworking+PromiseKit.m */; }; 27 | 5A0FC94829A17322C5D1F8D7 /* Pods_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 240DBD0C20C6C4AC011A16AB /* Pods_Tests.framework */; }; 28 | B0214F66B71CED6A5736EDDF /* Pods_PromiseKit_AFNetworking.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0C33A15B665F3F4C42F5003 /* Pods_PromiseKit_AFNetworking.framework */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | 0666CC90192961BC00110C1B /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 0666CC62192961BC00110C1B /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 0666CC69192961BC00110C1B; 37 | remoteInfo = "PromiseKit+AFNetworking"; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 06559D4719F59C5B00EE7DE5 /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPods.a; path = "Pods/build/Debug-iphoneos/libPods.a"; sourceTree = ""; }; 43 | 06559D4919F5A45E00EE7DE5 /* HTTPClient+PromiseKitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "HTTPClient+PromiseKitTests.m"; sourceTree = ""; }; 44 | 06559D4B19F5A49100EE7DE5 /* TestCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestCommon.h; sourceTree = ""; }; 45 | 0666CC6A192961BC00110C1B /* PromiseKit+AFNetworking.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "PromiseKit+AFNetworking.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 0666CC6D192961BC00110C1B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 47 | 0666CC6F192961BC00110C1B /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 48 | 0666CC71192961BC00110C1B /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 49 | 0666CC75192961BC00110C1B /* PromiseKit+AFNetworking-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PromiseKit+AFNetworking-Info.plist"; sourceTree = ""; }; 50 | 0666CC77192961BC00110C1B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 51 | 0666CC79192961BC00110C1B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 0666CC7B192961BC00110C1B /* PromiseKit+AFNetworking-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PromiseKit+AFNetworking-Prefix.pch"; sourceTree = ""; }; 53 | 0666CC7C192961BC00110C1B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 54 | 0666CC7D192961BC00110C1B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 55 | 0666CC80192961BC00110C1B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 56 | 0666CC82192961BC00110C1B /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 57 | 0666CC83192961BC00110C1B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 58 | 0666CC85192961BC00110C1B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 59 | 0666CC8B192961BC00110C1B /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 0666CC8C192961BC00110C1B /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 61 | 0666CC94192961BC00110C1B /* PromiseKit+AFNetworkingTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PromiseKit+AFNetworkingTests-Info.plist"; sourceTree = ""; }; 62 | 0666CC96192961BC00110C1B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 63 | 0666CC98192961BC00110C1B /* AFHTTPRequestOperation+PromiseTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "AFHTTPRequestOperation+PromiseTests.m"; sourceTree = ""; }; 64 | 06B81A8C19F3F18C00A8CF14 /* AFNetworking+PromiseKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AFNetworking+PromiseKit.h"; sourceTree = ""; }; 65 | 06B81A8D19F3F18C00A8CF14 /* AFNetworking+PromiseKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AFNetworking+PromiseKit.m"; sourceTree = ""; }; 66 | 0F4227DEF417C6F618D5918D /* Pods-PromiseKit+AFNetworking.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PromiseKit+AFNetworking.release.xcconfig"; path = "Pods/Target Support Files/Pods-PromiseKit+AFNetworking/Pods-PromiseKit+AFNetworking.release.xcconfig"; sourceTree = ""; }; 67 | 240DBD0C20C6C4AC011A16AB /* Pods_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 68 | 468E42E9FFEFCB6B8583FCEE /* 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 = ""; }; 69 | 4E1FAA6F2180165500ABCC54 /* PromiseKit+AFNetworking-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PromiseKit+AFNetworking-Bridging-Header.h"; sourceTree = ""; }; 70 | 8AEAB2E2EA0C34F16181045F /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 71 | 9FCCE12EF63ECDDA86B9B74D /* Pods-PromiseKit+AFNetworking.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PromiseKit+AFNetworking.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PromiseKit+AFNetworking/Pods-PromiseKit+AFNetworking.debug.xcconfig"; sourceTree = ""; }; 72 | B0C33A15B665F3F4C42F5003 /* Pods_PromiseKit_AFNetworking.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PromiseKit_AFNetworking.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 73 | E48D58E13F4BD8C3756975FE /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74 | E9A299DE9A54CE253A26E387 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 75 | F0855C7DD91C82C533ABE940 /* 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 = ""; }; 76 | /* End PBXFileReference section */ 77 | 78 | /* Begin PBXFrameworksBuildPhase section */ 79 | 0666CC67192961BC00110C1B /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | 0666CC70192961BC00110C1B /* CoreGraphics.framework in Frameworks */, 84 | 0666CC72192961BC00110C1B /* UIKit.framework in Frameworks */, 85 | 0666CC6E192961BC00110C1B /* Foundation.framework in Frameworks */, 86 | B0214F66B71CED6A5736EDDF /* Pods_PromiseKit_AFNetworking.framework in Frameworks */, 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | 0666CC88192961BC00110C1B /* Frameworks */ = { 91 | isa = PBXFrameworksBuildPhase; 92 | buildActionMask = 2147483647; 93 | files = ( 94 | 0666CC8D192961BC00110C1B /* XCTest.framework in Frameworks */, 95 | 0666CC8F192961BC00110C1B /* UIKit.framework in Frameworks */, 96 | 0666CC8E192961BC00110C1B /* Foundation.framework in Frameworks */, 97 | 5A0FC94829A17322C5D1F8D7 /* Pods_Tests.framework in Frameworks */, 98 | ); 99 | runOnlyForDeploymentPostprocessing = 0; 100 | }; 101 | /* End PBXFrameworksBuildPhase section */ 102 | 103 | /* Begin PBXGroup section */ 104 | 0666CC61192961BC00110C1B = { 105 | isa = PBXGroup; 106 | children = ( 107 | 0666CC73192961BC00110C1B /* PromiseKit+AFNetworking */, 108 | 0666CC92192961BC00110C1B /* PromiseKit+AFNetworkingTests */, 109 | 0666CC6C192961BC00110C1B /* Frameworks */, 110 | 0666CC6B192961BC00110C1B /* Products */, 111 | 5E879C4478851978A19DDAE9 /* Pods */, 112 | ); 113 | sourceTree = ""; 114 | }; 115 | 0666CC6B192961BC00110C1B /* Products */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 0666CC6A192961BC00110C1B /* PromiseKit+AFNetworking.app */, 119 | 0666CC8B192961BC00110C1B /* Tests.xctest */, 120 | ); 121 | name = Products; 122 | sourceTree = ""; 123 | }; 124 | 0666CC6C192961BC00110C1B /* Frameworks */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 06559D4719F59C5B00EE7DE5 /* libPods.a */, 128 | 0666CC6D192961BC00110C1B /* Foundation.framework */, 129 | 0666CC6F192961BC00110C1B /* CoreGraphics.framework */, 130 | 0666CC71192961BC00110C1B /* UIKit.framework */, 131 | 0666CC8C192961BC00110C1B /* XCTest.framework */, 132 | E48D58E13F4BD8C3756975FE /* Pods.framework */, 133 | 240DBD0C20C6C4AC011A16AB /* Pods_Tests.framework */, 134 | B0C33A15B665F3F4C42F5003 /* Pods_PromiseKit_AFNetworking.framework */, 135 | ); 136 | name = Frameworks; 137 | sourceTree = ""; 138 | }; 139 | 0666CC73192961BC00110C1B /* PromiseKit+AFNetworking */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 0666CC7C192961BC00110C1B /* AppDelegate.h */, 143 | 0666CC7D192961BC00110C1B /* AppDelegate.m */, 144 | 06B81A8C19F3F18C00A8CF14 /* AFNetworking+PromiseKit.h */, 145 | 06B81A8D19F3F18C00A8CF14 /* AFNetworking+PromiseKit.m */, 146 | 0666CC7F192961BC00110C1B /* Main.storyboard */, 147 | 0666CC82192961BC00110C1B /* ViewController.h */, 148 | 0666CC83192961BC00110C1B /* ViewController.m */, 149 | 0666CC85192961BC00110C1B /* Images.xcassets */, 150 | 0666CC74192961BC00110C1B /* Supporting Files */, 151 | 4E1FAA6F2180165500ABCC54 /* PromiseKit+AFNetworking-Bridging-Header.h */, 152 | ); 153 | path = "PromiseKit+AFNetworking"; 154 | sourceTree = ""; 155 | }; 156 | 0666CC74192961BC00110C1B /* Supporting Files */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | 0666CC75192961BC00110C1B /* PromiseKit+AFNetworking-Info.plist */, 160 | 0666CC76192961BC00110C1B /* InfoPlist.strings */, 161 | 0666CC79192961BC00110C1B /* main.m */, 162 | 0666CC7B192961BC00110C1B /* PromiseKit+AFNetworking-Prefix.pch */, 163 | ); 164 | name = "Supporting Files"; 165 | sourceTree = ""; 166 | }; 167 | 0666CC92192961BC00110C1B /* PromiseKit+AFNetworkingTests */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | 06559D4B19F5A49100EE7DE5 /* TestCommon.h */, 171 | 0666CC98192961BC00110C1B /* AFHTTPRequestOperation+PromiseTests.m */, 172 | 06559D4919F5A45E00EE7DE5 /* HTTPClient+PromiseKitTests.m */, 173 | 0666CC93192961BC00110C1B /* Supporting Files */, 174 | ); 175 | path = "PromiseKit+AFNetworkingTests"; 176 | sourceTree = ""; 177 | }; 178 | 0666CC93192961BC00110C1B /* Supporting Files */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | 0666CC94192961BC00110C1B /* PromiseKit+AFNetworkingTests-Info.plist */, 182 | 0666CC95192961BC00110C1B /* InfoPlist.strings */, 183 | ); 184 | name = "Supporting Files"; 185 | sourceTree = ""; 186 | }; 187 | 5E879C4478851978A19DDAE9 /* Pods */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | E9A299DE9A54CE253A26E387 /* Pods.debug.xcconfig */, 191 | 8AEAB2E2EA0C34F16181045F /* Pods.release.xcconfig */, 192 | 468E42E9FFEFCB6B8583FCEE /* Pods-Tests.debug.xcconfig */, 193 | F0855C7DD91C82C533ABE940 /* Pods-Tests.release.xcconfig */, 194 | 9FCCE12EF63ECDDA86B9B74D /* Pods-PromiseKit+AFNetworking.debug.xcconfig */, 195 | 0F4227DEF417C6F618D5918D /* Pods-PromiseKit+AFNetworking.release.xcconfig */, 196 | ); 197 | name = Pods; 198 | sourceTree = ""; 199 | }; 200 | /* End PBXGroup section */ 201 | 202 | /* Begin PBXNativeTarget section */ 203 | 0666CC69192961BC00110C1B /* PromiseKit+AFNetworking */ = { 204 | isa = PBXNativeTarget; 205 | buildConfigurationList = 0666CC9C192961BC00110C1B /* Build configuration list for PBXNativeTarget "PromiseKit+AFNetworking" */; 206 | buildPhases = ( 207 | A8BB19614AB6150F40950910 /* [CP] Check Pods Manifest.lock */, 208 | 0666CC66192961BC00110C1B /* Sources */, 209 | 0666CC67192961BC00110C1B /* Frameworks */, 210 | 0666CC68192961BC00110C1B /* Resources */, 211 | C955D3B604F9E72808635D3F /* [CP] Embed Pods Frameworks */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | ); 217 | name = "PromiseKit+AFNetworking"; 218 | productName = "PromiseKit+AFNetworking"; 219 | productReference = 0666CC6A192961BC00110C1B /* PromiseKit+AFNetworking.app */; 220 | productType = "com.apple.product-type.application"; 221 | }; 222 | 0666CC8A192961BC00110C1B /* Tests */ = { 223 | isa = PBXNativeTarget; 224 | buildConfigurationList = 0666CC9F192961BC00110C1B /* Build configuration list for PBXNativeTarget "Tests" */; 225 | buildPhases = ( 226 | 07234467CF8904FCEFCD7DF2 /* [CP] Check Pods Manifest.lock */, 227 | 1F0DA65DEF5603F8D6F8B6F5 /* 📦 Check Pods Manifest.lock */, 228 | 0666CC87192961BC00110C1B /* Sources */, 229 | 0666CC88192961BC00110C1B /* Frameworks */, 230 | 0666CC89192961BC00110C1B /* Resources */, 231 | 3361F322409B62D1038B54F3 /* 📦 Embed Pods Frameworks */, 232 | 0059975E72701F5371B00538 /* [CP] Embed Pods Frameworks */, 233 | ); 234 | buildRules = ( 235 | ); 236 | dependencies = ( 237 | 0666CC91192961BC00110C1B /* PBXTargetDependency */, 238 | ); 239 | name = Tests; 240 | productName = "PromiseKit+AFNetworkingTests"; 241 | productReference = 0666CC8B192961BC00110C1B /* Tests.xctest */; 242 | productType = "com.apple.product-type.bundle.unit-test"; 243 | }; 244 | /* End PBXNativeTarget section */ 245 | 246 | /* Begin PBXProject section */ 247 | 0666CC62192961BC00110C1B /* Project object */ = { 248 | isa = PBXProject; 249 | attributes = { 250 | LastUpgradeCheck = 1030; 251 | ORGANIZATIONNAME = Oramind; 252 | TargetAttributes = { 253 | 0666CC69192961BC00110C1B = { 254 | LastSwiftMigration = 1000; 255 | }; 256 | 0666CC8A192961BC00110C1B = { 257 | TestTargetID = 0666CC69192961BC00110C1B; 258 | }; 259 | }; 260 | }; 261 | buildConfigurationList = 0666CC65192961BC00110C1B /* Build configuration list for PBXProject "PromiseKit+AFNetworking" */; 262 | compatibilityVersion = "Xcode 3.2"; 263 | developmentRegion = English; 264 | hasScannedForEncodings = 0; 265 | knownRegions = ( 266 | English, 267 | en, 268 | Base, 269 | ); 270 | mainGroup = 0666CC61192961BC00110C1B; 271 | productRefGroup = 0666CC6B192961BC00110C1B /* Products */; 272 | projectDirPath = ""; 273 | projectRoot = ""; 274 | targets = ( 275 | 0666CC69192961BC00110C1B /* PromiseKit+AFNetworking */, 276 | 0666CC8A192961BC00110C1B /* Tests */, 277 | ); 278 | }; 279 | /* End PBXProject section */ 280 | 281 | /* Begin PBXResourcesBuildPhase section */ 282 | 0666CC68192961BC00110C1B /* Resources */ = { 283 | isa = PBXResourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | 0666CC86192961BC00110C1B /* Images.xcassets in Resources */, 287 | 0666CC78192961BC00110C1B /* InfoPlist.strings in Resources */, 288 | 0666CC81192961BC00110C1B /* Main.storyboard in Resources */, 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | }; 292 | 0666CC89192961BC00110C1B /* Resources */ = { 293 | isa = PBXResourcesBuildPhase; 294 | buildActionMask = 2147483647; 295 | files = ( 296 | 0666CC97192961BC00110C1B /* InfoPlist.strings in Resources */, 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | /* End PBXResourcesBuildPhase section */ 301 | 302 | /* Begin PBXShellScriptBuildPhase section */ 303 | 0059975E72701F5371B00538 /* [CP] Embed Pods Frameworks */ = { 304 | isa = PBXShellScriptBuildPhase; 305 | buildActionMask = 2147483647; 306 | files = ( 307 | ); 308 | inputPaths = ( 309 | "${PODS_ROOT}/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh", 310 | "${BUILT_PRODUCTS_DIR}/Expecta/Expecta.framework", 311 | ); 312 | name = "[CP] Embed Pods Frameworks"; 313 | outputPaths = ( 314 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Expecta.framework", 315 | ); 316 | runOnlyForDeploymentPostprocessing = 0; 317 | shellPath = /bin/sh; 318 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh\"\n"; 319 | showEnvVarsInLog = 0; 320 | }; 321 | 07234467CF8904FCEFCD7DF2 /* [CP] Check Pods Manifest.lock */ = { 322 | isa = PBXShellScriptBuildPhase; 323 | buildActionMask = 2147483647; 324 | files = ( 325 | ); 326 | inputFileListPaths = ( 327 | ); 328 | inputPaths = ( 329 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 330 | "${PODS_ROOT}/Manifest.lock", 331 | ); 332 | name = "[CP] Check Pods Manifest.lock"; 333 | outputFileListPaths = ( 334 | ); 335 | outputPaths = ( 336 | "$(DERIVED_FILE_DIR)/Pods-Tests-checkManifestLockResult.txt", 337 | ); 338 | runOnlyForDeploymentPostprocessing = 0; 339 | shellPath = /bin/sh; 340 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 341 | showEnvVarsInLog = 0; 342 | }; 343 | 1F0DA65DEF5603F8D6F8B6F5 /* 📦 Check Pods Manifest.lock */ = { 344 | isa = PBXShellScriptBuildPhase; 345 | buildActionMask = 2147483647; 346 | files = ( 347 | ); 348 | inputPaths = ( 349 | ); 350 | name = "📦 Check Pods Manifest.lock"; 351 | outputPaths = ( 352 | ); 353 | runOnlyForDeploymentPostprocessing = 0; 354 | shellPath = /bin/sh; 355 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 356 | showEnvVarsInLog = 0; 357 | }; 358 | 3361F322409B62D1038B54F3 /* 📦 Embed Pods Frameworks */ = { 359 | isa = PBXShellScriptBuildPhase; 360 | buildActionMask = 2147483647; 361 | files = ( 362 | ); 363 | inputPaths = ( 364 | ); 365 | name = "📦 Embed Pods Frameworks"; 366 | outputPaths = ( 367 | ); 368 | runOnlyForDeploymentPostprocessing = 0; 369 | shellPath = /bin/sh; 370 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh\"\n"; 371 | showEnvVarsInLog = 0; 372 | }; 373 | A8BB19614AB6150F40950910 /* [CP] Check Pods Manifest.lock */ = { 374 | isa = PBXShellScriptBuildPhase; 375 | buildActionMask = 2147483647; 376 | files = ( 377 | ); 378 | inputFileListPaths = ( 379 | ); 380 | inputPaths = ( 381 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 382 | "${PODS_ROOT}/Manifest.lock", 383 | ); 384 | name = "[CP] Check Pods Manifest.lock"; 385 | outputFileListPaths = ( 386 | ); 387 | outputPaths = ( 388 | "$(DERIVED_FILE_DIR)/Pods-PromiseKit+AFNetworking-checkManifestLockResult.txt", 389 | ); 390 | runOnlyForDeploymentPostprocessing = 0; 391 | shellPath = /bin/sh; 392 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 393 | showEnvVarsInLog = 0; 394 | }; 395 | C955D3B604F9E72808635D3F /* [CP] Embed Pods Frameworks */ = { 396 | isa = PBXShellScriptBuildPhase; 397 | buildActionMask = 2147483647; 398 | files = ( 399 | ); 400 | inputPaths = ( 401 | "${PODS_ROOT}/Target Support Files/Pods-PromiseKit+AFNetworking/Pods-PromiseKit+AFNetworking-frameworks.sh", 402 | "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework", 403 | "${BUILT_PRODUCTS_DIR}/PromiseKit/PromiseKit.framework", 404 | ); 405 | name = "[CP] Embed Pods Frameworks"; 406 | outputPaths = ( 407 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework", 408 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PromiseKit.framework", 409 | ); 410 | runOnlyForDeploymentPostprocessing = 0; 411 | shellPath = /bin/sh; 412 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PromiseKit+AFNetworking/Pods-PromiseKit+AFNetworking-frameworks.sh\"\n"; 413 | showEnvVarsInLog = 0; 414 | }; 415 | /* End PBXShellScriptBuildPhase section */ 416 | 417 | /* Begin PBXSourcesBuildPhase section */ 418 | 0666CC66192961BC00110C1B /* Sources */ = { 419 | isa = PBXSourcesBuildPhase; 420 | buildActionMask = 2147483647; 421 | files = ( 422 | 0666CC84192961BC00110C1B /* ViewController.m in Sources */, 423 | 06B81A8E19F3F18C00A8CF14 /* AFNetworking+PromiseKit.m in Sources */, 424 | 0666CC7E192961BC00110C1B /* AppDelegate.m in Sources */, 425 | 0666CC7A192961BC00110C1B /* main.m in Sources */, 426 | ); 427 | runOnlyForDeploymentPostprocessing = 0; 428 | }; 429 | 0666CC87192961BC00110C1B /* Sources */ = { 430 | isa = PBXSourcesBuildPhase; 431 | buildActionMask = 2147483647; 432 | files = ( 433 | 0666CC99192961BC00110C1B /* AFHTTPRequestOperation+PromiseTests.m in Sources */, 434 | 06559D4A19F5A45E00EE7DE5 /* HTTPClient+PromiseKitTests.m in Sources */, 435 | 06559D4619F5927F00EE7DE5 /* AFNetworking+PromiseKit.m in Sources */, 436 | ); 437 | runOnlyForDeploymentPostprocessing = 0; 438 | }; 439 | /* End PBXSourcesBuildPhase section */ 440 | 441 | /* Begin PBXTargetDependency section */ 442 | 0666CC91192961BC00110C1B /* PBXTargetDependency */ = { 443 | isa = PBXTargetDependency; 444 | target = 0666CC69192961BC00110C1B /* PromiseKit+AFNetworking */; 445 | targetProxy = 0666CC90192961BC00110C1B /* PBXContainerItemProxy */; 446 | }; 447 | /* End PBXTargetDependency section */ 448 | 449 | /* Begin PBXVariantGroup section */ 450 | 0666CC76192961BC00110C1B /* InfoPlist.strings */ = { 451 | isa = PBXVariantGroup; 452 | children = ( 453 | 0666CC77192961BC00110C1B /* en */, 454 | ); 455 | name = InfoPlist.strings; 456 | sourceTree = ""; 457 | }; 458 | 0666CC7F192961BC00110C1B /* Main.storyboard */ = { 459 | isa = PBXVariantGroup; 460 | children = ( 461 | 0666CC80192961BC00110C1B /* Base */, 462 | ); 463 | name = Main.storyboard; 464 | sourceTree = ""; 465 | }; 466 | 0666CC95192961BC00110C1B /* InfoPlist.strings */ = { 467 | isa = PBXVariantGroup; 468 | children = ( 469 | 0666CC96192961BC00110C1B /* en */, 470 | ); 471 | name = InfoPlist.strings; 472 | sourceTree = ""; 473 | }; 474 | /* End PBXVariantGroup section */ 475 | 476 | /* Begin XCBuildConfiguration section */ 477 | 0666CC9A192961BC00110C1B /* Debug */ = { 478 | isa = XCBuildConfiguration; 479 | buildSettings = { 480 | ALWAYS_SEARCH_USER_PATHS = NO; 481 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 482 | CLANG_CXX_LIBRARY = "libc++"; 483 | CLANG_ENABLE_MODULES = YES; 484 | CLANG_ENABLE_OBJC_ARC = YES; 485 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 486 | CLANG_WARN_BOOL_CONVERSION = YES; 487 | CLANG_WARN_COMMA = YES; 488 | CLANG_WARN_CONSTANT_CONVERSION = YES; 489 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 490 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 491 | CLANG_WARN_EMPTY_BODY = YES; 492 | CLANG_WARN_ENUM_CONVERSION = YES; 493 | CLANG_WARN_INFINITE_RECURSION = YES; 494 | CLANG_WARN_INT_CONVERSION = YES; 495 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 496 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 497 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 498 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 499 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 500 | CLANG_WARN_STRICT_PROTOTYPES = YES; 501 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 502 | CLANG_WARN_UNREACHABLE_CODE = YES; 503 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 504 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 505 | COPY_PHASE_STRIP = NO; 506 | ENABLE_STRICT_OBJC_MSGSEND = YES; 507 | ENABLE_TESTABILITY = YES; 508 | GCC_C_LANGUAGE_STANDARD = gnu99; 509 | GCC_DYNAMIC_NO_PIC = NO; 510 | GCC_NO_COMMON_BLOCKS = YES; 511 | GCC_OPTIMIZATION_LEVEL = 0; 512 | GCC_PREPROCESSOR_DEFINITIONS = ( 513 | "DEBUG=1", 514 | "$(inherited)", 515 | ); 516 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 517 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 518 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 519 | GCC_WARN_UNDECLARED_SELECTOR = YES; 520 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 521 | GCC_WARN_UNUSED_FUNCTION = YES; 522 | GCC_WARN_UNUSED_VARIABLE = YES; 523 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 524 | ONLY_ACTIVE_ARCH = YES; 525 | SDKROOT = iphoneos; 526 | }; 527 | name = Debug; 528 | }; 529 | 0666CC9B192961BC00110C1B /* Release */ = { 530 | isa = XCBuildConfiguration; 531 | buildSettings = { 532 | ALWAYS_SEARCH_USER_PATHS = NO; 533 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 534 | CLANG_CXX_LIBRARY = "libc++"; 535 | CLANG_ENABLE_MODULES = YES; 536 | CLANG_ENABLE_OBJC_ARC = YES; 537 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 538 | CLANG_WARN_BOOL_CONVERSION = YES; 539 | CLANG_WARN_COMMA = YES; 540 | CLANG_WARN_CONSTANT_CONVERSION = YES; 541 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 542 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 543 | CLANG_WARN_EMPTY_BODY = YES; 544 | CLANG_WARN_ENUM_CONVERSION = YES; 545 | CLANG_WARN_INFINITE_RECURSION = YES; 546 | CLANG_WARN_INT_CONVERSION = YES; 547 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 548 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 549 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 550 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 551 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 552 | CLANG_WARN_STRICT_PROTOTYPES = YES; 553 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 554 | CLANG_WARN_UNREACHABLE_CODE = YES; 555 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 556 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 557 | COPY_PHASE_STRIP = YES; 558 | ENABLE_NS_ASSERTIONS = NO; 559 | ENABLE_STRICT_OBJC_MSGSEND = YES; 560 | GCC_C_LANGUAGE_STANDARD = gnu99; 561 | GCC_NO_COMMON_BLOCKS = YES; 562 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 563 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 564 | GCC_WARN_UNDECLARED_SELECTOR = YES; 565 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 566 | GCC_WARN_UNUSED_FUNCTION = YES; 567 | GCC_WARN_UNUSED_VARIABLE = YES; 568 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 569 | SDKROOT = iphoneos; 570 | VALIDATE_PRODUCT = YES; 571 | }; 572 | name = Release; 573 | }; 574 | 0666CC9D192961BC00110C1B /* Debug */ = { 575 | isa = XCBuildConfiguration; 576 | baseConfigurationReference = 9FCCE12EF63ECDDA86B9B74D /* Pods-PromiseKit+AFNetworking.debug.xcconfig */; 577 | buildSettings = { 578 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 579 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 580 | CLANG_ENABLE_MODULES = YES; 581 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 582 | GCC_PREFIX_HEADER = "PromiseKit+AFNetworking/PromiseKit+AFNetworking-Prefix.pch"; 583 | INFOPLIST_FILE = "PromiseKit+AFNetworking/PromiseKit+AFNetworking-Info.plist"; 584 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 585 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 586 | PRODUCT_BUNDLE_IDENTIFIER = "com.oramind.${PRODUCT_NAME:rfc1034identifier}"; 587 | PRODUCT_NAME = "$(TARGET_NAME)"; 588 | SWIFT_OBJC_BRIDGING_HEADER = "PromiseKit+AFNetworking/PromiseKit+AFNetworking-Bridging-Header.h"; 589 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 590 | SWIFT_VERSION = 4.0; 591 | WRAPPER_EXTENSION = app; 592 | }; 593 | name = Debug; 594 | }; 595 | 0666CC9E192961BC00110C1B /* Release */ = { 596 | isa = XCBuildConfiguration; 597 | baseConfigurationReference = 0F4227DEF417C6F618D5918D /* Pods-PromiseKit+AFNetworking.release.xcconfig */; 598 | buildSettings = { 599 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 600 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 601 | CLANG_ENABLE_MODULES = YES; 602 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 603 | GCC_PREFIX_HEADER = "PromiseKit+AFNetworking/PromiseKit+AFNetworking-Prefix.pch"; 604 | INFOPLIST_FILE = "PromiseKit+AFNetworking/PromiseKit+AFNetworking-Info.plist"; 605 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 606 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 607 | PRODUCT_BUNDLE_IDENTIFIER = "com.oramind.${PRODUCT_NAME:rfc1034identifier}"; 608 | PRODUCT_NAME = "$(TARGET_NAME)"; 609 | SWIFT_OBJC_BRIDGING_HEADER = "PromiseKit+AFNetworking/PromiseKit+AFNetworking-Bridging-Header.h"; 610 | SWIFT_VERSION = 4.0; 611 | WRAPPER_EXTENSION = app; 612 | }; 613 | name = Release; 614 | }; 615 | 0666CCA0192961BC00110C1B /* Debug */ = { 616 | isa = XCBuildConfiguration; 617 | baseConfigurationReference = 468E42E9FFEFCB6B8583FCEE /* Pods-Tests.debug.xcconfig */; 618 | buildSettings = { 619 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/PromiseKit+AFNetworking.app/PromiseKit+AFNetworking"; 620 | FRAMEWORK_SEARCH_PATHS = ( 621 | "$(SDKROOT)/Developer/Library/Frameworks", 622 | "$(inherited)", 623 | "$(DEVELOPER_FRAMEWORKS_DIR)", 624 | ); 625 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 626 | GCC_PREFIX_HEADER = "PromiseKit+AFNetworking/PromiseKit+AFNetworking-Prefix.pch"; 627 | GCC_PREPROCESSOR_DEFINITIONS = ( 628 | "DEBUG=1", 629 | "$(inherited)", 630 | ); 631 | INFOPLIST_FILE = "PromiseKit+AFNetworkingTests/PromiseKit+AFNetworkingTests-Info.plist"; 632 | LIBRARY_SEARCH_PATHS = ( 633 | "$(inherited)", 634 | "$(PROJECT_DIR)/Pods/build/Debug-iphoneos", 635 | ); 636 | PRODUCT_BUNDLE_IDENTIFIER = "com.oramind.${PRODUCT_NAME:rfc1034identifier}"; 637 | PRODUCT_NAME = "$(TARGET_NAME)"; 638 | TEST_HOST = "$(BUNDLE_LOADER)"; 639 | WRAPPER_EXTENSION = xctest; 640 | }; 641 | name = Debug; 642 | }; 643 | 0666CCA1192961BC00110C1B /* Release */ = { 644 | isa = XCBuildConfiguration; 645 | baseConfigurationReference = F0855C7DD91C82C533ABE940 /* Pods-Tests.release.xcconfig */; 646 | buildSettings = { 647 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/PromiseKit+AFNetworking.app/PromiseKit+AFNetworking"; 648 | FRAMEWORK_SEARCH_PATHS = ( 649 | "$(SDKROOT)/Developer/Library/Frameworks", 650 | "$(inherited)", 651 | "$(DEVELOPER_FRAMEWORKS_DIR)", 652 | ); 653 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 654 | GCC_PREFIX_HEADER = "PromiseKit+AFNetworking/PromiseKit+AFNetworking-Prefix.pch"; 655 | INFOPLIST_FILE = "PromiseKit+AFNetworkingTests/PromiseKit+AFNetworkingTests-Info.plist"; 656 | LIBRARY_SEARCH_PATHS = ( 657 | "$(inherited)", 658 | "$(PROJECT_DIR)/Pods/build/Debug-iphoneos", 659 | ); 660 | PRODUCT_BUNDLE_IDENTIFIER = "com.oramind.${PRODUCT_NAME:rfc1034identifier}"; 661 | PRODUCT_NAME = "$(TARGET_NAME)"; 662 | TEST_HOST = "$(BUNDLE_LOADER)"; 663 | WRAPPER_EXTENSION = xctest; 664 | }; 665 | name = Release; 666 | }; 667 | /* End XCBuildConfiguration section */ 668 | 669 | /* Begin XCConfigurationList section */ 670 | 0666CC65192961BC00110C1B /* Build configuration list for PBXProject "PromiseKit+AFNetworking" */ = { 671 | isa = XCConfigurationList; 672 | buildConfigurations = ( 673 | 0666CC9A192961BC00110C1B /* Debug */, 674 | 0666CC9B192961BC00110C1B /* Release */, 675 | ); 676 | defaultConfigurationIsVisible = 0; 677 | defaultConfigurationName = Release; 678 | }; 679 | 0666CC9C192961BC00110C1B /* Build configuration list for PBXNativeTarget "PromiseKit+AFNetworking" */ = { 680 | isa = XCConfigurationList; 681 | buildConfigurations = ( 682 | 0666CC9D192961BC00110C1B /* Debug */, 683 | 0666CC9E192961BC00110C1B /* Release */, 684 | ); 685 | defaultConfigurationIsVisible = 0; 686 | defaultConfigurationName = Release; 687 | }; 688 | 0666CC9F192961BC00110C1B /* Build configuration list for PBXNativeTarget "Tests" */ = { 689 | isa = XCConfigurationList; 690 | buildConfigurations = ( 691 | 0666CCA0192961BC00110C1B /* Debug */, 692 | 0666CCA1192961BC00110C1B /* Release */, 693 | ); 694 | defaultConfigurationIsVisible = 0; 695 | defaultConfigurationName = Release; 696 | }; 697 | /* End XCConfigurationList section */ 698 | }; 699 | rootObject = 0666CC62192961BC00110C1B /* Project object */; 700 | } 701 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking.xcodeproj/xcuserdata/soulstorm.xcuserdatad/xcschemes/PromiseKit+AFNetworking.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking.xcodeproj/xcuserdata/soulstorm.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PromiseKit+AFNetworking.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 0666CC69192961BC00110C1B 16 | 17 | primary 18 | 19 | 20 | 0666CC8A192961BC00110C1B 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/AFNetworking+PromiseKit.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014 Christos Sotiriou 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | #import 25 | #import 26 | 27 | 28 | #define AFPromise AnyPromise 29 | FOUNDATION_EXPORT const NSString *AFHTTPRequestOperationErrorKey; 30 | 31 | 32 | #define kPMKAFResponseObjectKey @"responseObject" 33 | #define kPMKAFResponseTaskKey @"task" 34 | #define kPMKAFResponseOperationKey @"operation" 35 | 36 | @interface AFHTTPSessionManager (Promises) 37 | 38 | @property (nonatomic, assign) BOOL startTasksImmediately; 39 | 40 | - (AFPromise *)POST:(NSString *)urlString parameters:(id)parameters; 41 | - (AFPromise *)POST:(NSString *)urlString parameters:(id)parameters constructingBodyWithBlock:(void (^)(id))block; 42 | - (AFPromise *)GET:(NSString *)urlString parameters:(id)parameters; 43 | - (AFPromise *)PUT:(NSString *)urlString parameters:(id)parameters; 44 | - (AFPromise *)HEAD:(NSString *)urlString parameters:(id)parameters; 45 | - (AFPromise *)PATCH:(NSString *)urlString parameters:(id)parameters; 46 | - (AFPromise *)DELETE:(NSString *)urlString parameters:(id)parameters; 47 | 48 | 49 | /** 50 | * Returns a Promise, with a ready-to-use data task, by performing the corresponding operation to the default AFHTTPSessionManager. 51 | * WARNING: The default behaviour of the task is NOT to run immediately. 52 | * You must call '-resume' to the pointer in order to actually make the request. If you want to change this behaviour, set 53 | * 'startTasksImmediately' to YES 54 | * 55 | * @param request the request to perform 56 | * @param task Pass a pointer to the task, in order to have the task returned to this pointer. 57 | * 58 | * @return a Promise. 59 | */ 60 | - (AFPromise *)dataTaskWithRequest:(NSURLRequest *)request 61 | task:(NSURLSessionTask * __autoreleasing *)task; 62 | 63 | /** 64 | * Returns a Promise, with a ready-to-use data task, by performing the corresponding operation to the default AFHTTPSessionManager. 65 | * WARNING: The default behaviour of the task is NOT to run immediately. 66 | * You must call '-resume' to the pointer in order to actually make the request. If you want to change this behaviour, set 67 | * 'startTasksImmediately' to YES 68 | * 69 | * @param request 70 | * @param fileURL 71 | * @param progress 72 | * @param uploadTask 73 | * 74 | * @return a Promise 75 | */ 76 | - (AFPromise *)uploadTaskWithRequest:(NSURLRequest *)request 77 | fromFile:(NSURL *)fileURL 78 | progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock 79 | uploadTask:(NSURLSessionTask * __autoreleasing *)uploadTask; 80 | 81 | /** 82 | * Returns a Promise, with a ready-to-use data task, by performing the corresponding operation to the default AFHTTPSessionManager. 83 | * WARNING: The default behaviour of the task is NOT to run immediately. 84 | * You must call '-resume' to the pointer in order to actually make the request. If you want to change this behaviour, set 85 | * 'startTasksImmediately' to YES 86 | * 87 | * @param request 88 | * @param bodyData 89 | * @param progress 90 | * @param uploadTask 91 | * 92 | * @return 93 | */ 94 | - (AFPromise *)uploadTaskWithRequest:(NSURLRequest *)request 95 | fromData:(NSData *)bodyData 96 | progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock 97 | uploadTask:(NSURLSessionTask * __autoreleasing *)uploadTask; 98 | 99 | /** 100 | * Returns a Promise, with a ready-to-use data task, by performing the corresponding operation to the default AFHTTPSessionManager. 101 | * WARNING: The default behaviour of the task is NOT to run immediately. 102 | * You must call '-resume' to the pointer in order to actually make the request. If you want to change this behaviour, set 103 | * 'startTasksImmediately' to YES 104 | * 105 | * @param request 106 | * @param progress 107 | * @param uploadTask 108 | * 109 | * @return 110 | */ 111 | - (AFPromise *)uploadTaskWithStreamedRequest:(NSURLRequest *)request 112 | progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock 113 | uploadTask:(NSURLSessionTask * __autoreleasing *)uploadTask; 114 | 115 | /** 116 | * Returns a Promise, with a ready-to-use data task, by performing the corresponding operation to the default AFHTTPSessionManager. 117 | * WARNING: The default behaviour of the task is NOT to run immediately. 118 | * You must call '-resume' to the pointer in order to actually make the request. If you want to change this behaviour, set 119 | * 'startTasksImmediately' to YES 120 | * 121 | * @param request 122 | * @param progress 123 | * @param destination 124 | * @param downloadTask 125 | * 126 | * @return 127 | */ 128 | - (AFPromise *)downloadTaskWithRequest:(NSURLRequest *)request 129 | progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock 130 | destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination 131 | downloadTask:(NSURLSessionTask * __autoreleasing *)downloadTask; 132 | 133 | /** 134 | * Returns a Promise, with a ready-to-use data task, by performing the corresponding operation to the default AFHTTPSessionManager. 135 | * WARNING: The default behaviour of the task is NOT to run immediately. 136 | * You must call '-resume' to the pointer in order to actually make the request. If you want to change this behaviour, set 137 | * 'startTasksImmediately' to YES 138 | * 139 | * @param resumeData 140 | * @param progress 141 | * @param destination 142 | * @param downloadTask 143 | * 144 | * @return 145 | */ 146 | - (AFPromise *)downloadTaskWithResumeData:(NSData *)resumeData 147 | progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock 148 | destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination 149 | downloadTask:(NSURLSessionTask * __autoreleasing *)downloadTask; 150 | 151 | 152 | 153 | /** 154 | * @brief Performs a GET request on multiple URLs. It uses 'when' under the hood 155 | * 156 | * The parameters to be passed on URLs are given using an the associative array in 'parametersArray'. If you want to pass 'nil' as parameters, pass 157 | * an empty NSDictionary instead. 158 | * 159 | * When all requests are finished a 'then(^(NSArray *responsesArray){})' will return an array with NSDictionaries. Each one will have two values: 160 | * -- kPMKAFResponseObjectKey --> The response Object of the request 161 | * -- kPMKAFResponseTaskKey --> The task that initiated the request 162 | * 163 | * @param urlStringsArray an array of relative URL Strings 164 | * @param parametersArray an associative array of parameters to be passed to their corresponding 165 | * URL strings (will be associated by their position in the array, so make sure they match) 166 | */ 167 | - (AFPromise *)GETMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray; 168 | 169 | 170 | /** 171 | * @brief Performs a PUT request on multiple URLs. It uses 'when' under the hood 172 | * 173 | * The parameters to be passed on URLs are given using an the associative array in 'parametersArray'. If you want to pass 'nil' as parameters, pass 174 | * an empty NSDictionary instead. 175 | * 176 | * When all requests are finished a 'then(^(NSArray *responsesArray){})' will return an array with NSDictionaries. Each one will have two values: 177 | * -- kPMKAFResponseObjectKey --> The response Object of the request 178 | * -- kPMKAFResponseTaskKey --> The task that initiated the request 179 | * 180 | * @param urlStringsArray an array of relative URL Strings 181 | * @param parametersArray an associative array of parameters to be passed to their corresponding 182 | * URL strings (will be associated by their position in the array, so make sure they match) 183 | */ 184 | - (AFPromise *)PUTMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray; 185 | 186 | /** 187 | * @brief Performs a HEAD request on multiple URLs. It uses 'when' under the hood 188 | * 189 | * The parameters to be passed on URLs are given using an the associative array in 'parametersArray'. If you want to pass 'nil' as parameters, pass 190 | * an empty NSDictionary instead. 191 | * 192 | * When all requests are finished a 'then(^(NSArray *responsesArray){})' will return an array with NSDictionaries. Each one will have two values: 193 | * -- kPMKAFResponseObjectKey --> The response Object of the request 194 | * -- kPMKAFResponseTaskKey --> The task that initiated the request 195 | * 196 | * @param urlStringsArray an array of relative URL Strings 197 | * @param parametersArray an associative array of parameters to be passed to their corresponding 198 | * URL strings (will be associated by their position in the array, so make sure they match) 199 | */ 200 | - (AFPromise *)HEADMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray; 201 | 202 | /** 203 | * @brief Performs a PATCH request on multiple URLs. It uses 'when' under the hood 204 | * 205 | * The parameters to be passed on URLs are given using an the associative array in 'parametersArray'. If you want to pass 'nil' as parameters, pass 206 | * an empty NSDictionary instead. 207 | * 208 | * When all requests are finished a 'then(^(NSArray *responsesArray){})' will return an array with NSDictionaries. Each one will have two values: 209 | * -- kPMKAFResponseObjectKey --> The response Object of the request 210 | * -- kPMKAFResponseTaskKey --> The task that initiated the request 211 | * 212 | * @param urlStringsArray an array of relative URL Strings 213 | * @param parametersArray an associative array of parameters to be passed to their corresponding 214 | * URL strings (will be associated by their position in the array, so make sure they match) 215 | */ 216 | - (AFPromise *)PATCHMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray; 217 | 218 | 219 | /** 220 | * @brief Performs a DELETE request on multiple URLs. It uses 'when' under the hood 221 | * 222 | * The parameters to be passed on URLs are given using an the associative array in 'parametersArray'. If you want to pass 'nil' as parameters, pass 223 | * an empty NSDictionary instead. 224 | * 225 | * When all requests are finished a 'then(^(NSArray *responsesArray){})' will return an array with NSDictionaries. Each one will have two values: 226 | * -- kPMKAFResponseObjectKey --> The response Object of the request 227 | * -- kPMKAFResponseTaskKey --> The task that initiated the request 228 | * 229 | * @param urlStringsArray an array of relative URL Strings 230 | * @param parametersArray an associative array of parameters to be passed to their corresponding 231 | * URL strings (will be associated by their position in the array, so make sure they match) 232 | */ 233 | - (AFPromise *)DELETEMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray; 234 | 235 | @end 236 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/AFNetworking+PromiseKit.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014 Christos Sotiriou 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import "AFNetworking+PromiseKit.h" 26 | #import 27 | 28 | 29 | const NSString *AFHTTPRequestOperationErrorKey = @"afHTTPRequestOperationError"; 30 | static char AFHTTP_startTasksImmediately_PROPERTY_KEY; 31 | 32 | typedef enum { 33 | AF_OPERATION_POST, 34 | AF_OPERATION_GET, 35 | AF_OPERATION_PATCH, 36 | AF_OPERATION_DELETE, 37 | AF_OPERATION_HEAD, 38 | AF_OPERATION_PUT 39 | } AF_OPERATION_KIND; 40 | 41 | @implementation AFHTTPSessionManager (Promises) 42 | @dynamic startTasksImmediately; 43 | 44 | - (void)setStartTasksImmediately:(BOOL)startTasksImmediately 45 | { 46 | objc_setAssociatedObject(self, &AFHTTP_startTasksImmediately_PROPERTY_KEY, @(startTasksImmediately), OBJC_ASSOCIATION_RETAIN); 47 | } 48 | 49 | - (BOOL)startTasksImmediately 50 | { 51 | NSNumber *booleanNumber = objc_getAssociatedObject(self, &AFHTTP_startTasksImmediately_PROPERTY_KEY); 52 | return booleanNumber.boolValue; 53 | } 54 | 55 | - (NSURLSessionTask *__autoreleasing *)pointerToTaskFromTask:(NSURLSessionTask * __autoreleasing *)task { 56 | // create a pointer to a task, since we can't have a nil value 57 | if (!task) { 58 | NSURLSessionTask *__autoreleasing pointer; 59 | NSURLSessionTask *__autoreleasing *replacement = &pointer; 60 | task = replacement; 61 | } 62 | return task; 63 | } 64 | 65 | - (AFPromise *)dataTaskWithRequest:(NSURLRequest *)request 66 | task:(NSURLSessionTask * __autoreleasing *)task 67 | { 68 | task = [self pointerToTaskFromTask:task]; 69 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 70 | *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { 71 | if (error) { 72 | resolve(error); 73 | } 74 | else { 75 | resolve(PMKManifold(response, responseObject)); 76 | } 77 | }]; 78 | if (self.startTasksImmediately) [*task resume]; 79 | }]; 80 | } 81 | 82 | - (AFPromise *)uploadTaskWithRequest:(NSURLRequest *)request 83 | fromFile:(NSURL *)fileURL 84 | progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock 85 | uploadTask:(NSURLSessionTask * __autoreleasing *)uploadTask 86 | { 87 | uploadTask = [self pointerToTaskFromTask:uploadTask]; 88 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 89 | *uploadTask = [self uploadTaskWithRequest:request fromFile:fileURL progress:uploadProgressBlock completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { 90 | if (error) { 91 | resolve(error); 92 | } 93 | else { 94 | resolve(PMKManifold(response, responseObject)); 95 | } 96 | }]; 97 | if (self.startTasksImmediately) [*uploadTask resume];; 98 | }]; 99 | } 100 | 101 | - (AFPromise *)uploadTaskWithRequest:(NSURLRequest *)request 102 | fromData:(NSData *)bodyData 103 | progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock 104 | uploadTask:(NSURLSessionTask * __autoreleasing *)uploadTask 105 | { 106 | uploadTask = [self pointerToTaskFromTask:uploadTask]; 107 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 108 | *uploadTask = [self uploadTaskWithRequest:request fromData:bodyData progress:uploadProgressBlock completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { 109 | if (error) { 110 | resolve(error); 111 | } 112 | else { 113 | resolve(PMKManifold(response, responseObject)); 114 | } 115 | }]; 116 | if (self.startTasksImmediately) [*uploadTask resume]; 117 | }]; 118 | } 119 | 120 | - (AFPromise *)uploadTaskWithStreamedRequest:(NSURLRequest *)request 121 | progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock 122 | uploadTask:(NSURLSessionTask * __autoreleasing *)uploadTask 123 | { 124 | uploadTask = [self pointerToTaskFromTask:uploadTask]; 125 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 126 | *uploadTask = [self uploadTaskWithStreamedRequest:request progress:uploadProgressBlock completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { 127 | if (error) { 128 | resolve(error); 129 | } 130 | else { 131 | resolve(PMKManifold(response, responseObject)); 132 | } 133 | }]; 134 | if (self.startTasksImmediately) [*uploadTask resume]; 135 | }]; 136 | } 137 | 138 | - (AFPromise *)downloadTaskWithRequest:(NSURLRequest *)request 139 | progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock 140 | destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination 141 | downloadTask:(NSURLSessionTask * __autoreleasing *)downloadTask 142 | { 143 | downloadTask = [self pointerToTaskFromTask:downloadTask]; 144 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 145 | *downloadTask = [self downloadTaskWithRequest:request progress:uploadProgressBlock destination:destination completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) { 146 | if (error) { 147 | resolve(error); 148 | } 149 | else { 150 | resolve(PMKManifold(response, filePath)); 151 | } 152 | }]; 153 | if (self.startTasksImmediately) [*downloadTask resume]; 154 | }]; 155 | } 156 | 157 | - (AFPromise *)downloadTaskWithResumeData:(NSData *)resumeData 158 | progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock 159 | destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination 160 | downloadTask:(NSURLSessionTask * __autoreleasing *)downloadTask 161 | { 162 | downloadTask = [self pointerToTaskFromTask:downloadTask]; 163 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 164 | *downloadTask = [self downloadTaskWithResumeData:resumeData progress:uploadProgressBlock destination:destination completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) { 165 | if (error) { 166 | resolve(error); 167 | } 168 | else { 169 | resolve(PMKManifold(response, filePath)); 170 | } 171 | }]; 172 | if (self.startTasksImmediately) [*downloadTask resume]; 173 | }]; 174 | } 175 | 176 | 177 | - (AFPromise *)POST:(NSString *)urlString parameters:(id)parameters 178 | { 179 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 180 | [[self POST:urlString parameters:parameters progress:nil success:^(NSURLSessionDataTask *task, id responseObject) { 181 | resolve(PMKManifold(responseObject, task)); 182 | } failure:^(NSURLSessionDataTask *task, NSError *error) { 183 | resolve(error); 184 | }] resume]; 185 | }]; 186 | } 187 | 188 | - (AFPromise *)POSTMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray 189 | { 190 | return [self operationSequenceWithType:AF_OPERATION_POST urls:urlStringsArray parameters:parametersArray]; 191 | } 192 | 193 | - (AFPromise *)POST:(NSString *)urlString parameters:(id)parameters constructingBodyWithBlock:(void (^)(id))block 194 | { 195 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 196 | [[self POST:urlString parameters:parameters constructingBodyWithBlock:block progress:nil success:^(NSURLSessionDataTask *task, id responseObject) { 197 | resolve(PMKManifold(responseObject, task)); 198 | } failure:^(NSURLSessionDataTask *task, NSError *error) { 199 | resolve(error); 200 | }] resume]; 201 | }]; 202 | } 203 | 204 | 205 | - (AFPromise *)GET:(NSString *)urlString parameters:(id)parameters 206 | { 207 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 208 | 209 | [[self GET:urlString parameters:parameters progress:nil success:^(NSURLSessionDataTask *task, id responseObject) { 210 | resolve(PMKManifold(responseObject, task)); 211 | } failure:^(NSURLSessionDataTask *task, NSError *error) { 212 | resolve(error); 213 | }] resume]; 214 | }]; 215 | } 216 | 217 | - (AFPromise *)GETMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray 218 | { 219 | return [self operationSequenceWithType:AF_OPERATION_GET urls:urlStringsArray parameters:parametersArray]; 220 | } 221 | 222 | 223 | - (AFPromise *)PUT:(NSString *)urlString parameters:(id)parameters 224 | { 225 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 226 | [[self PUT:urlString parameters:parameters success:^(NSURLSessionDataTask *task, id responseObject) { 227 | resolve(PMKManifold(responseObject, task)); 228 | } failure:^(NSURLSessionDataTask *task, NSError *error) { 229 | resolve(error); 230 | }] resume]; 231 | }]; 232 | } 233 | 234 | - (AFPromise *)PUTMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray 235 | { 236 | return [self operationSequenceWithType:AF_OPERATION_PUT urls:urlStringsArray parameters:parametersArray]; 237 | } 238 | 239 | - (AFPromise *)HEAD:(NSString *)urlString parameters:(id)parameters 240 | { 241 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 242 | [[self HEAD:urlString parameters:parameters success:^(NSURLSessionDataTask *task) { 243 | resolve(task); 244 | } failure:^(NSURLSessionDataTask *task, NSError *error) { 245 | resolve(error); 246 | }] resume]; 247 | }]; 248 | } 249 | 250 | - (AFPromise *)HEADMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray 251 | { 252 | return [self operationSequenceWithType:AF_OPERATION_HEAD urls:urlStringsArray parameters:parametersArray]; 253 | } 254 | 255 | - (AFPromise *)PATCH:(NSString *)urlString parameters:(id)parameters 256 | { 257 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 258 | [[self PATCH:urlString parameters:parameters success:^(NSURLSessionDataTask *task, id responseObject) { 259 | resolve(PMKManifold(responseObject, task)); 260 | } failure:^(NSURLSessionDataTask *task, NSError *error) { 261 | resolve(error); 262 | }] resume]; 263 | }]; 264 | } 265 | 266 | - (AFPromise *)PATCHMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray 267 | { 268 | return [self operationSequenceWithType:AF_OPERATION_PATCH urls:urlStringsArray parameters:parametersArray]; 269 | } 270 | 271 | 272 | 273 | - (AFPromise *)DELETE:(NSString *)urlString parameters:(id)parameters 274 | { 275 | return [AFPromise promiseWithResolverBlock:^(PMKResolver resolve) { 276 | [[self DELETE:urlString parameters:parameters success:^(NSURLSessionDataTask *task, id responseObject) { 277 | resolve(PMKManifold(responseObject, task)); 278 | } failure:^(NSURLSessionDataTask *task, NSError *error) { 279 | resolve(error); 280 | }] resume]; 281 | }]; 282 | } 283 | 284 | - (AFPromise *)DELETEMultiple:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray 285 | { 286 | return [self operationSequenceWithType:AF_OPERATION_DELETE urls:urlStringsArray parameters:parametersArray]; 287 | } 288 | 289 | 290 | 291 | 292 | - (AFPromise *)operationSequenceWithType:(AF_OPERATION_KIND)operationKind urls:(NSArray *)urlStringsArray parameters:(NSArray *)parametersArray 293 | { 294 | assert (urlStringsArray.count == parametersArray.count); 295 | NSMutableArray *operations = [NSMutableArray array]; 296 | 297 | for (int i=0; i 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PromiseKit+AFNetworking 4 | // 5 | // Created by Christos Sotiriou on 19/5/14. 6 | // Copyright (c) 2014 Oramind. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/PromiseKit+AFNetworking-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/PromiseKit+AFNetworking-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 0.7.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 0.7.1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | 32 | UIMainStoryboardFile 33 | Main 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/PromiseKit+AFNetworking-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // PromiseTests 4 | // 5 | // Created by Christos Sotiriou on 17/5/14. 6 | // Copyright (c) 2014 Oramind. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // PromiseTests 4 | // 5 | // Created by Christos Sotiriou on 17/5/14. 6 | // Copyright (c) 2014 Oramind. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | #import "AFNetworking+PromiseKit.h" 12 | 13 | 14 | @interface ViewController () 15 | @property (nonatomic, strong) AFHTTPSessionManager *sessionManager; 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad 21 | { 22 | [super viewDidLoad]; 23 | 24 | self.sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:[[NSURL alloc] initWithString:@"http://oramind.com"]]; 25 | self.sessionManager.responseSerializer = [AFHTTPResponseSerializer serializer]; 26 | 27 | [self.sessionManager GETMultiple:@[@"/", @"/", @"/", @"/"] parameters:@[@{},@{},@{},@{}]].then(^(NSArray * responsesArray){ 28 | for (NSDictionary *responseDictionary in responsesArray){ 29 | NSLog(@"task description: %@", responseDictionary[kPMKAFResponseTaskKey]); 30 | NSLog(@"response object description: %@", responseDictionary[kPMKAFResponseObjectKey]); 31 | } 32 | }); 33 | 34 | //get the task 35 | NSURLSessionTask *task; 36 | 37 | //set the task to run immediately 38 | self.sessionManager.startTasksImmediately = YES; 39 | [self.sessionManager dataTaskWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://oramind.com/"]] task:&task]; 40 | NSLog(@"%@", task); 41 | 42 | 43 | 44 | } 45 | 46 | 47 | 48 | - (void)didReceiveMemoryWarning 49 | { 50 | [super didReceiveMemoryWarning]; 51 | // Dispose of any resources that can be recreated. 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworking/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PromiseKit+AFNetworking 4 | // 5 | // Created by Christos Sotiriou on 19/5/14. 6 | // Copyright (c) 2014 Oramind. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworkingTests/AFHTTPRequestOperation+PromiseTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PromiseKit_AFNetworkingTests.m 3 | // PromiseKit+AFNetworkingTests 4 | // 5 | // Created by Christos Sotiriou on 19/5/14. 6 | // Copyright (c) 2014 Oramind. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AFNetworking+PromiseKit.h" 11 | #import 12 | #define EXP_SHORTHAND 13 | #import "Expecta.h" 14 | #import "TestCommon.h" 15 | 16 | @interface PromiseKit_AFNetworkingTests : XCTestCase 17 | @end 18 | 19 | @implementation PromiseKit_AFNetworkingTests 20 | 21 | - (void)setUp 22 | { 23 | [super setUp]; 24 | } 25 | 26 | - (void)tearDown 27 | { 28 | // Put teardown code here. This method is called after the invocation of each test method in the class. 29 | [super tearDown]; 30 | } 31 | 32 | - (void)testSingleOperation 33 | { 34 | XCTestExpectation *expectation = [self expectationWithDescription:@"Operations completed"]; 35 | __block id response = nil; 36 | __block id operationCompleted = nil; 37 | 38 | [[[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:kTestURL]]] promiseAndStartImmediately].then(^(id responseObject, AFHTTPRequestOperation *operation){ 39 | response = responseObject; 40 | operationCompleted = operation; 41 | }).finally(^(){ 42 | [expectation fulfill]; 43 | }); 44 | 45 | [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { 46 | expect(error).to.beNil(); 47 | expect([operationCompleted isKindOfClass:[AFHTTPRequestOperation class]]).to.beTruthy(); 48 | expect([response isKindOfClass:[NSString class]]); 49 | }]; 50 | } 51 | 52 | - (void)testOperationSequence 53 | { 54 | XCTestExpectation *expectation = [self expectationWithDescription:@"Operations completed"]; 55 | __block int numberOfOperationsCompleted = 0; 56 | 57 | [[[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:kTestURL]]] promiseAndStartImmediately].then(^(id responseObject, AFHTTPRequestOperation *operation){ 58 | numberOfOperationsCompleted++; 59 | return [[[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:kTestURL]]] promiseAndStartImmediately]; 60 | }).then(^(){ 61 | numberOfOperationsCompleted++; 62 | }).finally(^(){ 63 | [expectation fulfill]; 64 | }); 65 | 66 | [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { 67 | expect(error).to.beNil(); 68 | expect(numberOfOperationsCompleted).to.equal(2); 69 | }]; 70 | } 71 | 72 | - (void)testOperationSequenceConcurrent 73 | { 74 | XCTestExpectation *expectation = [self expectationWithDescription:@"Operations completed"]; 75 | __block int numberOfOperationsCompleted = 0; 76 | 77 | PMKPromise *promise1 = [[[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:kTestURL]]] promiseAndStartImmediately].then(^(){ numberOfOperationsCompleted ++; }); 78 | PMKPromise *promise2 = [[[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:kTestURL]]] promiseAndStartImmediately].then(^(){ numberOfOperationsCompleted ++; }); 79 | 80 | PMKWhen(@[promise1, promise2]).then(^(){ 81 | [expectation fulfill]; 82 | }); 83 | 84 | [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { 85 | expect(error).to.beNil(); 86 | expect(numberOfOperationsCompleted).to.equal(2); 87 | }]; 88 | } 89 | 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworkingTests/HTTPClient+PromiseKitTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPClient+PromiseKitTests.m 3 | // PromiseKit+AFNetworking 4 | // 5 | // Created by Christos Sotiriou on 10/20/14. 6 | // Copyright (c) 2014 Oramind. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #import "AFNetworking+PromiseKit.h" 13 | #import 14 | #define EXP_SHORTHAND 15 | #import "Expecta.h" 16 | #import "TestCommon.h" 17 | 18 | 19 | @interface HTTPClient_PromiseKitTests : XCTestCase 20 | @property (nonatomic, strong) AFHTTPRequestOperationManager *operationManager; 21 | @end 22 | 23 | @implementation HTTPClient_PromiseKitTests 24 | 25 | - (void)setUp { 26 | [super setUp]; 27 | self.operationManager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:kTestURL]]; 28 | self.operationManager.responseSerializer = [AFHTTPResponseSerializer serializer]; 29 | } 30 | 31 | - (void)tearDown { 32 | // Put teardown code here. This method is called after the invocation of each test method in the class. 33 | [super tearDown]; 34 | } 35 | 36 | - (void)testSingleOperation { 37 | XCTestExpectation *expectation = [self expectationWithDescription:@"Operations completed"]; 38 | 39 | __block id response = nil; 40 | __block id operationCompleted = nil; 41 | 42 | 43 | [self.operationManager GET:@"ip" parameters:nil].then(^(id responseObject, AFHTTPRequestOperation *operation){ 44 | response = responseObject; 45 | operationCompleted = operation; 46 | [expectation fulfill]; 47 | }); 48 | 49 | [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { 50 | expect(error).to.beNil(); 51 | expect([operationCompleted isKindOfClass:[AFHTTPRequestOperation class]]).to.beTruthy(); 52 | expect([response isKindOfClass:[NSString class]]); 53 | }]; 54 | } 55 | 56 | - (void)testMultipleOperations{ 57 | XCTestExpectation *expectation = [self expectationWithDescription:@"Operations completed"]; 58 | __block int numberOfOperationsCompleted = 0; 59 | 60 | [self.operationManager GET:@"ip" parameters:nil].then(^(id responseObject, AFHTTPRequestOperation *operation){ 61 | numberOfOperationsCompleted++; 62 | return [self.operationManager GET:@"get" parameters:nil]; 63 | }).then(^(){ 64 | [expectation fulfill]; 65 | }); 66 | 67 | [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { 68 | expect(error).to.beNil(); 69 | }]; 70 | } 71 | 72 | - (void)testConcurrentOperations{ 73 | XCTestExpectation *expectation = [self expectationWithDescription:@"Operations completed"]; 74 | __block int numberOfOperationsCompleted = 0; 75 | 76 | PMKWhen(@[ 77 | [self.operationManager GET:@"ip" parameters:nil].then(^(){numberOfOperationsCompleted ++;}), 78 | [self.operationManager GET:@"get" parameters:nil].then(^(){numberOfOperationsCompleted ++;}) 79 | ]).then(^(){ 80 | [expectation fulfill]; 81 | }); 82 | 83 | [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { 84 | expect(error).to.beNil(); 85 | }]; 86 | } 87 | 88 | 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworkingTests/PromiseKit+AFNetworkingTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworkingTests/TestCommon.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestCommon.h 3 | // PromiseKit+AFNetworking 4 | // 5 | // Created by Christos Sotiriou on 10/20/14. 6 | // Copyright (c) 2014 Oramind. All rights reserved. 7 | // 8 | 9 | #ifndef PromiseKit_AFNetworking_TestCommon_h 10 | #define PromiseKit_AFNetworking_TestCommon_h 11 | 12 | #define kTestURL @"https://httpbin.org/" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /PromiseKit+AFNetworkingTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /PromiseKit-AFNetworking.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = 'PromiseKit-AFNetworking' 4 | s.version = '1.0.0' 5 | s.summary = 'PromiseKit extensions for AFNetworking' 6 | s.license = 'MIT' 7 | s.homepage = 'https://github.com/csotiriou/AFNetworking-PromiseKit/' 8 | s.source = { :git => 'https://github.com/csotiriou/AFNetworking-PromiseKit.git', :tag => s.version } 9 | 10 | s.author = { 'Christos Sotiriou' => 'csotiriou86@gmail.com' } 11 | 12 | s.public_header_files = 'PromiseKit+AFNetworking/AFNetworking+PromiseKit.h' 13 | s.source_files = 'PromiseKit+AFNetworking/AFNetworking+PromiseKit.{h,m}' 14 | s.requires_arc = true 15 | 16 | s.ios.deployment_target = '9.0' 17 | s.osx.deployment_target = '10.10' 18 | 19 | s.swift_versions = [ 20 | "4.0", 21 | "4.1", 22 | "4.2", 23 | "4.3", 24 | "4.4", 25 | "5.0", 26 | "5.1", 27 | "5.1" 28 | ] 29 | 30 | s.dependency 'AFNetworking', '~> 3.1.0' 31 | s.dependency 'PromiseKit/CorePromise', '~> 6.5.2' 32 | 33 | end 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PromiseKit+AFNetworking {#welcome} 2 | ===================== 3 | 4 | PromiseKit+AFNetworking is a small category addition to the delightful [PromiseKit][1], enabling it to work with the widely used [AFNetworking v 2.0][2] 5 | 6 | For the time being, it's a small category addition to the core AFNetworking, facilitating development with the plain AFHTTPRequestOperation and with the AFHTTPRequestOperationManager. 7 | 8 | # Note regarding PromiseKit 2.0: 9 | `PromiseKit+AFNetworking` now supports `PromiseKit 2.0`. Therefore, support for iOS 7 is dropped. If you wish to have PromiseKit + AFNetworking + iOS 7 support, please use a version of ‘AFNetworking-PromiseKit’ earlier than 0.5.0 10 | 11 | # Note regarding PromiseKit 3.0: 12 | `PromiseKit+AFNetworking` now supports `PromiseKit 3.0`. For PromiseKit 3.0, the ambiguity between PMKPromise and AnyPromise has been resolved, and only AnyPromise is used from now on. If you wish to have PromiseKit + AFNetworking + PromiseKit 2.0 support, please use a version of ‘AFNetworking-PromiseKit’ earlier than 0.6.0 13 | 14 | # Installation 15 | You have two options: Either use cocoapods (look into the appropriate section below), or 16 | just copy `AFNetworking+PromiseKit.h` and `AFNetworking+PromiseKit.m` in your project and use them. 17 | 18 | # Sample Uses: 19 | 20 | ### Plain HTTP Request 21 | ```objectivec 22 | [AFHTTPRequestOperation request:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://oramind.com/"]]].then(^(id responseObject){ 23 | NSLog(@"operation completed! %@", [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]); 24 | }).catch(^(NSError *error){ 25 | NSLog(@"error: %@", error.localizedDescription); 26 | NSLog(@"original operation: %@", error.userInfo[AFHTTPRequestOperationErrorKey]); 27 | }); 28 | ``` 29 | 30 | The above code will immediately execute the HTTP Request by adding it to the current queue, or the main queue if the current queue does not exist. You can also add it to a different queue (see the header file) 31 | 32 | ### AFHTTPRequestOperationManager 33 | ```objectivec 34 | self.manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:nil]; 35 | self.manager.responseSerializer = [AFHTTPResponseSerializer serializer]; 36 | 37 | 38 | [self.manager GET:@"http://www.error-url.ss/" parameters:nil].then(^(id responseObject, AFHTTPRequestOperation *operation){ 39 | NSLog(@"first request completed for operation: %@", operation.request.description); 40 | return [self.manager GET:@"http://www.apple.com" parameters:nil]; 41 | }).then(^{ 42 | NSLog(@"second request completed"); 43 | }).catch(^(NSError *error){ 44 | NSLog(@"error happened: %@", error.localizedDescription); 45 | NSLog(@"original operation: %@", error.userInfo[AFHTTPRequestOperationErrorKey]); 46 | }); 47 | 48 | ``` 49 | 50 | Objects returned by the plain AFHTTPRequestOperationManager are also returned here, as optional arguments (a response object of type 'id' and the AFHTTPRequestOperation). In case of errors, you can use the "catch" command of PromiseKit, and get the error thrown by AFNetworking and the original operation that spawned the error with 'error.userInfo[AFHTTPRequestOperationErrorKey]' 51 | 52 | Making concurrent operations is a simple matter of calling "-when" on PMKPromise as described in the official documentation. 53 | 54 | ```objectivec 55 | [PMKPromise when:@[ 56 | [self.operationManager GET:@"ip" parameters:nil].then(^(){numberOfOperationsCompleted ++;}), 57 | [self.operationManager GET:@"get" parameters:nil].then(^(){numberOfOperationsCompleted ++;}) 58 | ]].then(^(){ 59 | //do something when all operations are finished 60 | }); 61 | ``` 62 | 63 | ### AFHTTPSessionManager 64 | 65 | New: Now AFHTTPSessionManager is supported, for use with AFNetworking 2.0 and iOS 7 66 | 67 | Sample function that logins using an AFHTTPSessionManager below: 68 | ```objectivec 69 | - (PMKPromise *)loginWithUserName:(NSString *)userName andPassword:(NSString *)password 70 | { 71 | return [self.sessionManager POST:@"api/login" parameters:@{@"user": userName, @"password" : password}].then(^(id responseObject, NSURLSessionDataTask *dataTask){ 72 | //responseObject holds the response returned by AFNetworking 73 | //dataDask will hold an NSURLSessionDataTask associated with this request, like it happens in AFHTTPSessionManager 74 | }); 75 | } 76 | 77 | ``` 78 | 79 | Objects returned during these operations are optional here. Maximum arguments in "then()" blocks are "2", a responseObject (that has been deserialized by AFNetworking) and an NSURLSessionDataTask. 80 | 81 | Of course, chaining and making concurrent operations work the same way as in AFHTTPRequestOperationManager. 82 | 83 | ### `when` and getting the NSURLDataTask that initiated the request. 84 | Now you can get the `NSURLDataTask` that initiated the request when performing multiple concurrent requests with `when` 85 | 86 | ```objectivec 87 | [self.sessionManager GETMultiple:@[@"/", @"/", @"/", @"/"] parameters:@[@{},@{},@{},@{}]].then(^(NSArray * responsesArray){ 88 | for (NSDictionary *responseDictionary in responsesArray){ 89 | NSLog(@"task description: %@", responseDictionary[kPMKAFResponseTaskKey]); 90 | NSLog(@"response object description: %@", responseDictionary[kPMKAFResponseObjectKey]); 91 | } 92 | }); 93 | ``` 94 | ```objectivec 95 | [self.operationManager GETMultiple:@[@"/", @"/", @"/", @"/"] parameters:@[@{},@{},@{},@{}]].then(^(NSArray * responsesArray){ 96 | for (NSDictionary *responseDictionary in responsesArray){ 97 | NSLog(@"operation description: %@", responseDictionary[kPMKAFResponseOperationKey]); 98 | NSLog(@"response object description: %@", responseDictionary[kPMKAFResponseObjectKey]); 99 | } 100 | }); 101 | ``` 102 | 103 | # Samples 104 | Now unit tests are available, which demonstrate the basic functionality and give some basic examples on how to use this category. More unit tests are going to be added in the near future. 105 | 106 | 107 | # Pods integration 108 | You can use the project with CocoaPods. Simply put this line into your podfile: 109 | 110 | ``` 111 | pod 'PromiseKit-AFNetworking', '~>0.6' 112 | ``` 113 | 114 | # To Do 115 | - Add more unit tests 116 | - Add some goodies, in cases where they make sense. 117 | 118 | # Special Thanks 119 | Special thanks to Jeff Miller ( https://github.com/jeffmax ) for his fixes and ```pod```ification of this repo 120 | 121 | * Michael Lo ( https://github.com/mmmilo ) 122 | * Roberto ( https://github.com/robertomg ) 123 | * Jeff Miller ( https://github.com/jeffmax ) 124 | 125 | And, of course Max Howel, for PromiseKit (https://github.com/mxcl) 126 | 127 | 128 | # Disclaimer 129 | I have created this small addition in order to use it in a project I am making. I have had the opportunity to test it in real-life situations, but AFHTTPRequestOperationManager is not tested for DELETE, and PUT operations. If you find a bug, please submit a bug report. 130 | 131 | # Something missing? 132 | Of course something is missing. I have just began implementing this. If you have suggestions, additions, or you want to add a cool feature, I would be happy to hear about it. Please, please, please, leave your feedback and suggestions to the 'issues' section! 133 | 134 | 135 | [1]: http://promisekit.org 136 | [2]: https://github.com/AFNetworking/AFNetworking 137 | --------------------------------------------------------------------------------