├── LWConnetionDemo ├── LWConnetionDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── xunyanan.xcuserdatad │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ └── xunyanan.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints.xcbkptlist │ │ └── xcschemes │ │ ├── LWConnetionDemo.xcscheme │ │ └── xcschememanagement.plist └── LWConnetionDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── DownLoadTableViewCell.h │ ├── DownLoadTableViewCell.m │ ├── DownLoadTableViewController.h │ ├── DownLoadTableViewController.m │ ├── DownLoadTableViewController.xib │ ├── LWConnetion │ ├── LWConnectionManager.h │ ├── LWConnectionManager.m │ ├── LWConnectionOpertation.h │ ├── LWConnectionOpertation.m │ ├── LWFileHandle.h │ ├── LWFileHandle.m │ ├── LWRequest.h │ ├── LWRequest.m │ ├── LWResponse.h │ └── LWResponse.m │ ├── LWConnetionDemo-Info.plist │ ├── LWConnetionDemo-Prefix.pch │ ├── en.lproj │ └── InfoPlist.strings │ └── main.m └── README.md /LWConnetionDemo/LWConnetionDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DF0344BE17CE060B007E38F9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF0344BD17CE060B007E38F9 /* UIKit.framework */; }; 11 | DF0344C017CE060B007E38F9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF0344BF17CE060B007E38F9 /* Foundation.framework */; }; 12 | DF0344C217CE060B007E38F9 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF0344C117CE060B007E38F9 /* CoreGraphics.framework */; }; 13 | DF0344C817CE060B007E38F9 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DF0344C617CE060B007E38F9 /* InfoPlist.strings */; }; 14 | DF0344CA17CE060B007E38F9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DF0344C917CE060B007E38F9 /* main.m */; }; 15 | DF0344CE17CE060B007E38F9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DF0344CD17CE060B007E38F9 /* AppDelegate.m */; }; 16 | DF0344D017CE060B007E38F9 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = DF0344CF17CE060B007E38F9 /* Default.png */; }; 17 | DF0344D217CE060B007E38F9 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DF0344D117CE060B007E38F9 /* Default@2x.png */; }; 18 | DF0344D417CE060B007E38F9 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DF0344D317CE060B007E38F9 /* Default-568h@2x.png */; }; 19 | DF0344E317CE0662007E38F9 /* LWConnectionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DF0344DC17CE0662007E38F9 /* LWConnectionManager.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 20 | DF0344E417CE0662007E38F9 /* LWConnectionOpertation.m in Sources */ = {isa = PBXBuildFile; fileRef = DF0344DE17CE0662007E38F9 /* LWConnectionOpertation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 21 | DF0344E517CE0662007E38F9 /* LWRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = DF0344E017CE0662007E38F9 /* LWRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 22 | DF0344E617CE0662007E38F9 /* LWResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DF0344E217CE0662007E38F9 /* LWResponse.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 23 | DF444C7B17D471F40010ADB2 /* LWFileHandle.m in Sources */ = {isa = PBXBuildFile; fileRef = DF444C7A17D471F40010ADB2 /* LWFileHandle.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 24 | DF444C7F17D482410010ADB2 /* DownLoadTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DF444C7D17D482410010ADB2 /* DownLoadTableViewController.m */; }; 25 | DF444C8017D482410010ADB2 /* DownLoadTableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DF444C7E17D482410010ADB2 /* DownLoadTableViewController.xib */; }; 26 | DF444C8317D483D00010ADB2 /* DownLoadTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = DF444C8217D483D00010ADB2 /* DownLoadTableViewCell.m */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | DF0344BA17CE060B007E38F9 /* LWConnetionDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LWConnetionDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | DF0344BD17CE060B007E38F9 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 32 | DF0344BF17CE060B007E38F9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 33 | DF0344C117CE060B007E38F9 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 34 | DF0344C517CE060B007E38F9 /* LWConnetionDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "LWConnetionDemo-Info.plist"; sourceTree = ""; }; 35 | DF0344C717CE060B007E38F9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 36 | DF0344C917CE060B007E38F9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 37 | DF0344CB17CE060B007E38F9 /* LWConnetionDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "LWConnetionDemo-Prefix.pch"; sourceTree = ""; }; 38 | DF0344CC17CE060B007E38F9 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 39 | DF0344CD17CE060B007E38F9 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 40 | DF0344CF17CE060B007E38F9 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 41 | DF0344D117CE060B007E38F9 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 42 | DF0344D317CE060B007E38F9 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 43 | DF0344DB17CE0662007E38F9 /* LWConnectionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LWConnectionManager.h; sourceTree = ""; }; 44 | DF0344DC17CE0662007E38F9 /* LWConnectionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LWConnectionManager.m; sourceTree = ""; }; 45 | DF0344DD17CE0662007E38F9 /* LWConnectionOpertation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LWConnectionOpertation.h; sourceTree = ""; }; 46 | DF0344DE17CE0662007E38F9 /* LWConnectionOpertation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LWConnectionOpertation.m; sourceTree = ""; }; 47 | DF0344DF17CE0662007E38F9 /* LWRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LWRequest.h; sourceTree = ""; }; 48 | DF0344E017CE0662007E38F9 /* LWRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LWRequest.m; sourceTree = ""; }; 49 | DF0344E117CE0662007E38F9 /* LWResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LWResponse.h; sourceTree = ""; }; 50 | DF0344E217CE0662007E38F9 /* LWResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LWResponse.m; sourceTree = ""; }; 51 | DF444C7917D471F40010ADB2 /* LWFileHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LWFileHandle.h; sourceTree = ""; }; 52 | DF444C7A17D471F40010ADB2 /* LWFileHandle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LWFileHandle.m; sourceTree = ""; }; 53 | DF444C7C17D482410010ADB2 /* DownLoadTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownLoadTableViewController.h; sourceTree = ""; }; 54 | DF444C7D17D482410010ADB2 /* DownLoadTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DownLoadTableViewController.m; sourceTree = ""; }; 55 | DF444C7E17D482410010ADB2 /* DownLoadTableViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DownLoadTableViewController.xib; sourceTree = ""; }; 56 | DF444C8117D483D00010ADB2 /* DownLoadTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownLoadTableViewCell.h; sourceTree = ""; }; 57 | DF444C8217D483D00010ADB2 /* DownLoadTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DownLoadTableViewCell.m; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | DF0344B717CE060B007E38F9 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | DF0344BE17CE060B007E38F9 /* UIKit.framework in Frameworks */, 66 | DF0344C017CE060B007E38F9 /* Foundation.framework in Frameworks */, 67 | DF0344C217CE060B007E38F9 /* CoreGraphics.framework in Frameworks */, 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXFrameworksBuildPhase section */ 72 | 73 | /* Begin PBXGroup section */ 74 | DF0344B117CE060B007E38F9 = { 75 | isa = PBXGroup; 76 | children = ( 77 | DF0344C317CE060B007E38F9 /* LWConnetionDemo */, 78 | DF0344BC17CE060B007E38F9 /* Frameworks */, 79 | DF0344BB17CE060B007E38F9 /* Products */, 80 | ); 81 | sourceTree = ""; 82 | }; 83 | DF0344BB17CE060B007E38F9 /* Products */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | DF0344BA17CE060B007E38F9 /* LWConnetionDemo.app */, 87 | ); 88 | name = Products; 89 | sourceTree = ""; 90 | }; 91 | DF0344BC17CE060B007E38F9 /* Frameworks */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | DF0344BD17CE060B007E38F9 /* UIKit.framework */, 95 | DF0344BF17CE060B007E38F9 /* Foundation.framework */, 96 | DF0344C117CE060B007E38F9 /* CoreGraphics.framework */, 97 | ); 98 | name = Frameworks; 99 | sourceTree = ""; 100 | }; 101 | DF0344C317CE060B007E38F9 /* LWConnetionDemo */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | DF0344DA17CE0639007E38F9 /* LWConnetion */, 105 | DF0344CC17CE060B007E38F9 /* AppDelegate.h */, 106 | DF0344CD17CE060B007E38F9 /* AppDelegate.m */, 107 | DF444C7C17D482410010ADB2 /* DownLoadTableViewController.h */, 108 | DF444C7D17D482410010ADB2 /* DownLoadTableViewController.m */, 109 | DF444C8117D483D00010ADB2 /* DownLoadTableViewCell.h */, 110 | DF444C8217D483D00010ADB2 /* DownLoadTableViewCell.m */, 111 | DF444C7E17D482410010ADB2 /* DownLoadTableViewController.xib */, 112 | DF0344C417CE060B007E38F9 /* Supporting Files */, 113 | ); 114 | path = LWConnetionDemo; 115 | sourceTree = ""; 116 | }; 117 | DF0344C417CE060B007E38F9 /* Supporting Files */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | DF0344C517CE060B007E38F9 /* LWConnetionDemo-Info.plist */, 121 | DF0344C617CE060B007E38F9 /* InfoPlist.strings */, 122 | DF0344C917CE060B007E38F9 /* main.m */, 123 | DF0344CB17CE060B007E38F9 /* LWConnetionDemo-Prefix.pch */, 124 | DF0344CF17CE060B007E38F9 /* Default.png */, 125 | DF0344D117CE060B007E38F9 /* Default@2x.png */, 126 | DF0344D317CE060B007E38F9 /* Default-568h@2x.png */, 127 | ); 128 | name = "Supporting Files"; 129 | sourceTree = ""; 130 | }; 131 | DF0344DA17CE0639007E38F9 /* LWConnetion */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | DF0344DB17CE0662007E38F9 /* LWConnectionManager.h */, 135 | DF0344DC17CE0662007E38F9 /* LWConnectionManager.m */, 136 | DF0344DD17CE0662007E38F9 /* LWConnectionOpertation.h */, 137 | DF0344DE17CE0662007E38F9 /* LWConnectionOpertation.m */, 138 | DF444C7917D471F40010ADB2 /* LWFileHandle.h */, 139 | DF444C7A17D471F40010ADB2 /* LWFileHandle.m */, 140 | DF0344DF17CE0662007E38F9 /* LWRequest.h */, 141 | DF0344E017CE0662007E38F9 /* LWRequest.m */, 142 | DF0344E117CE0662007E38F9 /* LWResponse.h */, 143 | DF0344E217CE0662007E38F9 /* LWResponse.m */, 144 | ); 145 | path = LWConnetion; 146 | sourceTree = ""; 147 | }; 148 | /* End PBXGroup section */ 149 | 150 | /* Begin PBXNativeTarget section */ 151 | DF0344B917CE060B007E38F9 /* LWConnetionDemo */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = DF0344D717CE060B007E38F9 /* Build configuration list for PBXNativeTarget "LWConnetionDemo" */; 154 | buildPhases = ( 155 | DF0344B617CE060B007E38F9 /* Sources */, 156 | DF0344B717CE060B007E38F9 /* Frameworks */, 157 | DF0344B817CE060B007E38F9 /* Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | ); 163 | name = LWConnetionDemo; 164 | productName = LWConnetionDemo; 165 | productReference = DF0344BA17CE060B007E38F9 /* LWConnetionDemo.app */; 166 | productType = "com.apple.product-type.application"; 167 | }; 168 | /* End PBXNativeTarget section */ 169 | 170 | /* Begin PBXProject section */ 171 | DF0344B217CE060B007E38F9 /* Project object */ = { 172 | isa = PBXProject; 173 | attributes = { 174 | LastUpgradeCheck = 0460; 175 | ORGANIZATIONNAME = "寻 亚楠"; 176 | }; 177 | buildConfigurationList = DF0344B517CE060B007E38F9 /* Build configuration list for PBXProject "LWConnetionDemo" */; 178 | compatibilityVersion = "Xcode 3.2"; 179 | developmentRegion = English; 180 | hasScannedForEncodings = 0; 181 | knownRegions = ( 182 | en, 183 | ); 184 | mainGroup = DF0344B117CE060B007E38F9; 185 | productRefGroup = DF0344BB17CE060B007E38F9 /* Products */; 186 | projectDirPath = ""; 187 | projectRoot = ""; 188 | targets = ( 189 | DF0344B917CE060B007E38F9 /* LWConnetionDemo */, 190 | ); 191 | }; 192 | /* End PBXProject section */ 193 | 194 | /* Begin PBXResourcesBuildPhase section */ 195 | DF0344B817CE060B007E38F9 /* Resources */ = { 196 | isa = PBXResourcesBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | DF0344C817CE060B007E38F9 /* InfoPlist.strings in Resources */, 200 | DF0344D017CE060B007E38F9 /* Default.png in Resources */, 201 | DF0344D217CE060B007E38F9 /* Default@2x.png in Resources */, 202 | DF0344D417CE060B007E38F9 /* Default-568h@2x.png in Resources */, 203 | DF444C8017D482410010ADB2 /* DownLoadTableViewController.xib in Resources */, 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | /* End PBXResourcesBuildPhase section */ 208 | 209 | /* Begin PBXSourcesBuildPhase section */ 210 | DF0344B617CE060B007E38F9 /* Sources */ = { 211 | isa = PBXSourcesBuildPhase; 212 | buildActionMask = 2147483647; 213 | files = ( 214 | DF0344CA17CE060B007E38F9 /* main.m in Sources */, 215 | DF0344CE17CE060B007E38F9 /* AppDelegate.m in Sources */, 216 | DF0344E317CE0662007E38F9 /* LWConnectionManager.m in Sources */, 217 | DF0344E417CE0662007E38F9 /* LWConnectionOpertation.m in Sources */, 218 | DF0344E517CE0662007E38F9 /* LWRequest.m in Sources */, 219 | DF0344E617CE0662007E38F9 /* LWResponse.m in Sources */, 220 | DF444C7B17D471F40010ADB2 /* LWFileHandle.m in Sources */, 221 | DF444C7F17D482410010ADB2 /* DownLoadTableViewController.m in Sources */, 222 | DF444C8317D483D00010ADB2 /* DownLoadTableViewCell.m in Sources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXSourcesBuildPhase section */ 227 | 228 | /* Begin PBXVariantGroup section */ 229 | DF0344C617CE060B007E38F9 /* InfoPlist.strings */ = { 230 | isa = PBXVariantGroup; 231 | children = ( 232 | DF0344C717CE060B007E38F9 /* en */, 233 | ); 234 | name = InfoPlist.strings; 235 | sourceTree = ""; 236 | }; 237 | /* End PBXVariantGroup section */ 238 | 239 | /* Begin XCBuildConfiguration section */ 240 | DF0344D517CE060B007E38F9 /* Debug */ = { 241 | isa = XCBuildConfiguration; 242 | buildSettings = { 243 | ALWAYS_SEARCH_USER_PATHS = NO; 244 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 245 | CLANG_CXX_LIBRARY = "libc++"; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_WARN_CONSTANT_CONVERSION = YES; 248 | CLANG_WARN_EMPTY_BODY = YES; 249 | CLANG_WARN_ENUM_CONVERSION = YES; 250 | CLANG_WARN_INT_CONVERSION = YES; 251 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 252 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 253 | COPY_PHASE_STRIP = NO; 254 | GCC_C_LANGUAGE_STANDARD = gnu99; 255 | GCC_DYNAMIC_NO_PIC = NO; 256 | GCC_OPTIMIZATION_LEVEL = 0; 257 | GCC_PREPROCESSOR_DEFINITIONS = ( 258 | "DEBUG=1", 259 | "$(inherited)", 260 | ); 261 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 262 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 263 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 264 | GCC_WARN_UNUSED_VARIABLE = YES; 265 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 266 | ONLY_ACTIVE_ARCH = YES; 267 | SDKROOT = iphoneos; 268 | }; 269 | name = Debug; 270 | }; 271 | DF0344D617CE060B007E38F9 /* Release */ = { 272 | isa = XCBuildConfiguration; 273 | buildSettings = { 274 | ALWAYS_SEARCH_USER_PATHS = NO; 275 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 276 | CLANG_CXX_LIBRARY = "libc++"; 277 | CLANG_ENABLE_OBJC_ARC = YES; 278 | CLANG_WARN_CONSTANT_CONVERSION = YES; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INT_CONVERSION = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 284 | COPY_PHASE_STRIP = YES; 285 | GCC_C_LANGUAGE_STANDARD = gnu99; 286 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 287 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 288 | GCC_WARN_UNUSED_VARIABLE = YES; 289 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 290 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 291 | SDKROOT = iphoneos; 292 | VALIDATE_PRODUCT = YES; 293 | }; 294 | name = Release; 295 | }; 296 | DF0344D817CE060B007E38F9 /* Debug */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 300 | GCC_PREFIX_HEADER = "LWConnetionDemo/LWConnetionDemo-Prefix.pch"; 301 | INFOPLIST_FILE = "LWConnetionDemo/LWConnetionDemo-Info.plist"; 302 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 303 | PRODUCT_NAME = "$(TARGET_NAME)"; 304 | WRAPPER_EXTENSION = app; 305 | }; 306 | name = Debug; 307 | }; 308 | DF0344D917CE060B007E38F9 /* Release */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 312 | GCC_PREFIX_HEADER = "LWConnetionDemo/LWConnetionDemo-Prefix.pch"; 313 | INFOPLIST_FILE = "LWConnetionDemo/LWConnetionDemo-Info.plist"; 314 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 315 | PRODUCT_NAME = "$(TARGET_NAME)"; 316 | WRAPPER_EXTENSION = app; 317 | }; 318 | name = Release; 319 | }; 320 | /* End XCBuildConfiguration section */ 321 | 322 | /* Begin XCConfigurationList section */ 323 | DF0344B517CE060B007E38F9 /* Build configuration list for PBXProject "LWConnetionDemo" */ = { 324 | isa = XCConfigurationList; 325 | buildConfigurations = ( 326 | DF0344D517CE060B007E38F9 /* Debug */, 327 | DF0344D617CE060B007E38F9 /* Release */, 328 | ); 329 | defaultConfigurationIsVisible = 0; 330 | defaultConfigurationName = Release; 331 | }; 332 | DF0344D717CE060B007E38F9 /* Build configuration list for PBXNativeTarget "LWConnetionDemo" */ = { 333 | isa = XCConfigurationList; 334 | buildConfigurations = ( 335 | DF0344D817CE060B007E38F9 /* Debug */, 336 | DF0344D917CE060B007E38F9 /* Release */, 337 | ); 338 | defaultConfigurationIsVisible = 0; 339 | defaultConfigurationName = Release; 340 | }; 341 | /* End XCConfigurationList section */ 342 | }; 343 | rootObject = DF0344B217CE060B007E38F9 /* Project object */; 344 | } 345 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo.xcodeproj/project.xcworkspace/xcuserdata/xunyanan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunyn/LWConnetionDemo/ca4469fdfc62e326e91f8518664ada088c0b0df9/LWConnetionDemo/LWConnetionDemo.xcodeproj/project.xcworkspace/xcuserdata/xunyanan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo.xcodeproj/project.xcworkspace/xcuserdata/xunyanan.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo.xcodeproj/xcuserdata/xunyanan.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 18 | 19 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo.xcodeproj/xcuserdata/xunyanan.xcuserdatad/xcschemes/LWConnetionDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo.xcodeproj/xcuserdata/xunyanan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LWConnetionDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | DF0344B917CE060B007E38F9 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LWConnetionDemo 4 | // 5 | // Created by 寻 亚楠 on 13-8-28. 6 | // Copyright (c) 2013年 寻 亚楠. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LWConnetionDemo 4 | // 5 | // Created by 寻 亚楠 on 13-8-28. 6 | // Copyright (c) 2013年 寻 亚楠. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "DownLoadTableViewController.h" 11 | 12 | @implementation AppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | // Override point for customization after application launch. 18 | self.window.backgroundColor = [UIColor whiteColor]; 19 | [self.window makeKeyAndVisible]; 20 | self.window.rootViewController = [[DownLoadTableViewController alloc]initWithNibName:@"DownLoadTableViewController" bundle:nil]; 21 | return YES; 22 | } 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application 25 | { 26 | // 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. 27 | // 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. 28 | } 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application 31 | { 32 | // 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. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application 42 | { 43 | // 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. 44 | } 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application 47 | { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunyn/LWConnetionDemo/ca4469fdfc62e326e91f8518664ada088c0b0df9/LWConnetionDemo/LWConnetionDemo/Default-568h@2x.png -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunyn/LWConnetionDemo/ca4469fdfc62e326e91f8518664ada088c0b0df9/LWConnetionDemo/LWConnetionDemo/Default.png -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunyn/LWConnetionDemo/ca4469fdfc62e326e91f8518664ada088c0b0df9/LWConnetionDemo/LWConnetionDemo/Default@2x.png -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/DownLoadTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyTableViewCell.h 3 | // MultDownloader 4 | // 5 | // Created by Marcus on 12/4/12. 6 | // Copyright (c) 2012 Marcus. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DownLoadTableViewCell : UITableViewCell { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) UIImageView *imageView; 16 | @property (nonatomic, retain) UIProgressView *progressView; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/DownLoadTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyTableViewCell.m 3 | // MultDownloader 4 | // 5 | // Created by Marcus on 12/4/12. 6 | // Copyright (c) 2012 Marcus. All rights reserved. 7 | // 8 | 9 | #import "DownLoadTableViewCell.h" 10 | 11 | @implementation DownLoadTableViewCell 12 | 13 | @synthesize imageView; 14 | @synthesize progressView; 15 | 16 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 17 | { 18 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 19 | if (self) { 20 | // Initialization code 21 | imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 5, 40, 40)]; 22 | [self addSubview:imageView]; 23 | 24 | progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(60, 20, 250, 20)]; 25 | progressView.hidden = YES; 26 | [self addSubview:progressView]; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 32 | { 33 | [super setSelected:selected animated:animated]; 34 | 35 | // Configure the view for the selected state 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/DownLoadTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DownLoadTableViewController.h 3 | // LWConnetionDemo 4 | // 5 | // Created by 寻 亚楠 on 13-9-2. 6 | // Copyright (c) 2013年 寻 亚楠. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LWConnectionManager.h" 11 | #import "DownLoadTableViewCell.h" 12 | 13 | 14 | @interface DownLoadTableViewController : UITableViewController{ 15 | 16 | LWConnectionManager *connetionManager; 17 | NSArray * urlArr; 18 | } 19 | @end 20 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/DownLoadTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DownLoadTableViewController.m 3 | // LWConnetionDemo 4 | // 5 | // Created by 寻 亚楠 on 13-9-2. 6 | // Copyright (c) 2013年 寻 亚楠. All rights reserved. 7 | // 8 | 9 | #import "DownLoadTableViewController.h" 10 | 11 | @interface DownLoadTableViewController () 12 | 13 | @end 14 | 15 | @implementation DownLoadTableViewController 16 | 17 | - (id)initWithStyle:(UITableViewStyle)style 18 | { 19 | self = [super initWithStyle:style]; 20 | if (self) { 21 | // Custom initialization 22 | } 23 | return self; 24 | } 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | 30 | connetionManager = [LWConnectionManager defaultManager]; 31 | 32 | urlArr = [[NSArray alloc] initWithObjects:@"http://www.wallcoo.com/nature/Japan_Hokkaido_Furano_Country_field_1920x1200/wallpapers/1920x1080/Japan-Hokkaido-Landscape-WUXGA_country_field_0149.jpg", 33 | @"http://www.sodoos.com/cms/uploads/allimg/100224/8-100224215U8.jpg", 34 | @"http://www.sodoos.com/cms/uploads/allimg/100224/8-100224215I7.jpg", 35 | @"http://www.sodoos.com/cms/uploads/allimg/100224/8-100224220106.jpg",nil]; 36 | 37 | [self startDownload]; 38 | // Uncomment the following line to preserve selection between presentations. 39 | // self.clearsSelectionOnViewWillAppear = NO; 40 | 41 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 42 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 43 | } 44 | 45 | - (void)didReceiveMemoryWarning 46 | { 47 | [super didReceiveMemoryWarning]; 48 | // Dispose of any resources that can be recreated. 49 | } 50 | 51 | - (void)startDownload { 52 | for (int i = 0 ; i <[urlArr count]; i++) { 53 | LWRequest *request = [[LWRequest alloc] initWithTraget:[NSString stringWithFormat:@"%d",i] requestURL:[urlArr objectAtIndex:i] isPersistance:YES delegate:self]; 54 | [connetionManager addRequest:request]; 55 | } 56 | } 57 | 58 | #pragma mark - Table view data source 59 | 60 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 61 | { 62 | 63 | // Return the number of sections. 64 | return 1; 65 | } 66 | 67 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 68 | { 69 | 70 | // Return the number of rows in the section. 71 | return [urlArr count]; 72 | } 73 | 74 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 75 | { 76 | static NSString *CellIdentifier = @"Cell"; 77 | DownLoadTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 78 | if (cell == nil) { 79 | cell = [[DownLoadTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 80 | } 81 | 82 | // Configure the cell... 83 | 84 | 85 | return cell; 86 | } 87 | 88 | /* 89 | // Override to support conditional editing of the table view. 90 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath 91 | { 92 | // Return NO if you do not want the specified item to be editable. 93 | return YES; 94 | } 95 | */ 96 | 97 | /* 98 | // Override to support editing the table view. 99 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 100 | { 101 | if (editingStyle == UITableViewCellEditingStyleDelete) { 102 | // Delete the row from the data source 103 | [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 104 | } 105 | else if (editingStyle == UITableViewCellEditingStyleInsert) { 106 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view 107 | } 108 | } 109 | */ 110 | 111 | /* 112 | // Override to support rearranging the table view. 113 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath 114 | { 115 | } 116 | */ 117 | 118 | /* 119 | // Override to support conditional rearranging of the table view. 120 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath 121 | { 122 | // Return NO if you do not want the item to be re-orderable. 123 | return YES; 124 | } 125 | */ 126 | 127 | #pragma mark - Table view delegate 128 | 129 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 130 | { 131 | // Navigation logic may go here. Create and push another view controller. 132 | /* 133 | <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; 134 | // ... 135 | // Pass the selected object to the new view controller. 136 | [self.navigationController pushViewController:detailViewController animated:YES]; 137 | */ 138 | } 139 | 140 | 141 | #pragma mark -- LW connetion delegate 142 | - (void)downloadFinished:(LWResponse *)response 143 | { 144 | NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[response.responseTarget integerValue] inSection:0]; 145 | DownLoadTableViewCell *cell = (DownLoadTableViewCell *)[self.tableView cellForRowAtIndexPath:indexPath]; 146 | if (response.error) { 147 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[response.error description] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 148 | NSLog(@"response error %@",response.error); 149 | [alertView show]; 150 | } else { 151 | if (response.responseData) { 152 | UIImage *image = [UIImage imageWithData:response.responseData]; 153 | if (image) { 154 | if (cell) { 155 | [cell.imageView setImage:image]; 156 | [cell.progressView setHidden:YES]; 157 | } 158 | } 159 | } 160 | } 161 | } 162 | 163 | - (void)downloadInprogress:(LWResponse *)response 164 | { 165 | NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[response.responseTarget integerValue] inSection:0]; 166 | DownLoadTableViewCell *cell = (DownLoadTableViewCell *)[self.tableView cellForRowAtIndexPath:indexPath]; 167 | if (response.error) { 168 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[response.error description] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 169 | [alertView show]; 170 | } else { 171 | if (cell) { 172 | [cell.progressView setHidden:NO]; 173 | [cell.progressView setProgress:response.downloadRate]; 174 | } 175 | 176 | } 177 | } 178 | @end 179 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/DownLoadTableViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1552 5 | 12C3103 6 | 3084 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 2083 12 | 13 | 14 | IBProxyObject 15 | IBUITableView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBCocoaTouchFramework 28 | 29 | 30 | IBFirstResponder 31 | IBCocoaTouchFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 20}, {320, 460}} 37 | 38 | 39 | 3 40 | MQA 41 | 42 | NO 43 | YES 44 | NO 45 | 46 | 47 | IBUIScreenMetrics 48 | 49 | YES 50 | 51 | 52 | 53 | 54 | 55 | {320, 480} 56 | {480, 320} 57 | 58 | 59 | IBCocoaTouchFramework 60 | Retina 3.5 Full Screen 61 | 0 62 | 63 | IBCocoaTouchFramework 64 | NO 65 | 1 66 | 0 67 | YES 68 | 44 69 | 22 70 | 22 71 | 72 | 73 | 74 | 75 | 76 | 77 | view 78 | 79 | 80 | 81 | 5 82 | 83 | 84 | 85 | dataSource 86 | 87 | 88 | 89 | 6 90 | 91 | 92 | 93 | delegate 94 | 95 | 96 | 97 | 7 98 | 99 | 100 | 101 | 102 | 103 | 0 104 | 105 | 106 | 107 | 108 | 109 | -1 110 | 111 | 112 | File's Owner 113 | 114 | 115 | -2 116 | 117 | 118 | 119 | 120 | 4 121 | 122 | 123 | 124 | 125 | 126 | 127 | DownLoadTableViewController 128 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 129 | UIResponder 130 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 131 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 132 | 133 | 134 | 135 | 136 | 137 | 7 138 | 139 | 140 | 0 141 | IBCocoaTouchFramework 142 | YES 143 | 3 144 | 2083 145 | 146 | 147 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetion/LWConnectionManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // LWConnectionManager.h 3 | // LWConnection 4 | // 5 | // Created by 寻 亚楠 on 13-8-28. 6 | // Copyright (c) 2013年 寻 亚楠. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LWRequest.h" 11 | #import "LWResponse.h" 12 | #import "LWConnectionOpertation.h" 13 | 14 | 15 | #define MAX_CONCURRENT_OPERATION_COUNT 3 16 | 17 | @interface LWConnectionManager : NSObject { 18 | NSOperationQueue *downloadQueue; 19 | int i; 20 | } 21 | 22 | + (LWConnectionManager *)defaultManager; 23 | 24 | - (void)setMaxConcurrentOperationCount:(int)max; 25 | 26 | - (void)addRequest:(LWRequest *)reqeust; 27 | - (LWResponse *)addSynchronizedReqeust:(LWRequest *)request; 28 | @end 29 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetion/LWConnectionManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // DownladerManager.m 3 | // MultDownloader 4 | // 5 | // Created by Marcus on 12/4/12. 6 | // Copyright (c) 2012 Marcus. All rights reserved. 7 | // 8 | 9 | #import "LWConnectionManager.h" 10 | #import "LWConnectionOpertation.h" 11 | 12 | @interface LWConnectionManager () 13 | 14 | @end 15 | 16 | @implementation LWConnectionManager 17 | 18 | static LWConnectionManager *instance; 19 | 20 | 21 | 22 | + (LWConnectionManager *)defaultManager { 23 | if (!instance) { 24 | instance = [[self alloc] init]; 25 | } 26 | 27 | return instance; 28 | } 29 | 30 | - (id)init { 31 | if (self = [super init]) { 32 | downloadQueue = [[NSOperationQueue alloc] init]; 33 | downloadQueue.maxConcurrentOperationCount = MAX_CONCURRENT_OPERATION_COUNT; 34 | i = 0; 35 | } 36 | return self; 37 | } 38 | 39 | - (void)dealloc{ 40 | #if !__has_feature(objc_arc) 41 | [downloadQueue release]; 42 | [super dealloc]; 43 | #endif 44 | } 45 | 46 | - (void)setMaxConcurrentOperationCount:(int)max{ 47 | if (max >0) { 48 | downloadQueue.maxConcurrentOperationCount = max; 49 | } 50 | } 51 | 52 | - (void)addRequest:(LWRequest *)reqeust { 53 | LWConnectionOpertation *downloader = LW_AUTORELEASE([[LWConnectionOpertation alloc] initWithRequest:reqeust]); 54 | [downloadQueue addOperation:downloader]; 55 | i ++; 56 | } 57 | 58 | - (LWResponse *)addSynchronizedReqeust:(LWRequest *)request{ 59 | NSError *error; 60 | NSURLResponse *response; 61 | NSData *data= [NSURLConnection sendSynchronousRequest:request.request returningResponse:&response error:&error]; 62 | LWResponse *re = [[LWResponse alloc]init]; 63 | re.response = response; 64 | re.responseData = data; 65 | re.error = error; 66 | re.responseTarget = request.requestTarget; 67 | return re; 68 | } 69 | 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetion/LWConnectionOpertation.h: -------------------------------------------------------------------------------- 1 | // 2 | // LWConnectionOperation.h 3 | // LWConnection 4 | // 5 | // Created by 寻 亚楠 on 13-8-28. 6 | // Copyright (c) 2013年 寻 亚楠. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LWRequest.h" 11 | #import "LWResponse.h" 12 | #import "LWFileHandle.h" 13 | 14 | @protocol LWConnectionDelegate; 15 | @class LWRequest; 16 | @class LWFileHandle; 17 | 18 | @protocol LWConnectionDelegate 19 | 20 | - (void)downloadFinished:(LWResponse *)response; 21 | - (void)downloadInprogress:(LWResponse *)response; 22 | 23 | @end 24 | 25 | @interface LWConnectionOpertation : NSOperation { 26 | 27 | NSURLConnection *connection; 28 | NSMutableData *responseData; 29 | BOOL isFinished; 30 | unsigned long long startOffset; 31 | LWFileHandle *fileHandle; 32 | 33 | } 34 | 35 | @property (nonatomic, LW_STRONG) LWRequest *request; 36 | @property (nonatomic, LW_STRONG) LWResponse *response; 37 | @property (nonatomic, LW_WEAK) NSObject *delegate; 38 | 39 | 40 | 41 | - (id)initWithRequest:(LWRequest *)request_; 42 | 43 | @end 44 | 45 | 46 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetion/LWConnectionOpertation.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyDownloader.m 3 | // MultDownloader 4 | // 5 | // Created by Marcus on 12/4/12. 6 | // Copyright (c) 2012 Marcus. All rights reserved. 7 | // 8 | 9 | #import "LWConnectionOpertation.h" 10 | #import "LWRequest.h" 11 | #import "LWResponse.h" 12 | 13 | @interface LWConnectionOpertation () 14 | 15 | @end 16 | 17 | @implementation LWConnectionOpertation 18 | 19 | @synthesize request; 20 | @synthesize response; 21 | @synthesize delegate; 22 | 23 | 24 | - (void)main { 25 | connection = [[NSURLConnection alloc] initWithRequest:request.request delegate:self startImmediately:YES]; 26 | NSLog(@"request is %@",request); 27 | isFinished = NO; 28 | response.responseTarget = request.requestTarget; 29 | if (connection) { 30 | do { 31 | [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; 32 | } while (!isFinished); 33 | } 34 | } 35 | 36 | - (id)initWithRequest:(LWRequest *)request_ { 37 | if (self = [super init]) { 38 | self.request = request_; 39 | response = [[LWResponse alloc] init]; 40 | self.delegate = self.request.delegate; 41 | if (request.persistentType == SAVE_TO_FILE){ 42 | fileHandle = [[LWFileHandle alloc] initWithRequest:request]; 43 | }else{ 44 | fileHandle= nil; 45 | } 46 | startOffset = [fileHandle getStartOffSetWithPath]; 47 | [self.request setFileOffSet:startOffset]; 48 | } 49 | return self; 50 | } 51 | 52 | - (void)dealloc{ 53 | #if !__has_feature(objc_arc) 54 | [connection release]; 55 | [fileHandle release]; 56 | [request release]; 57 | [response release]; 58 | [super dealloc]; 59 | #endif 60 | } 61 | #pragma mark -- NS URL Connetion Delegate Protocal 62 | - (void)connection:(NSURLConnection *)connection_ didReceiveResponse:(NSURLResponse *)response_ { 63 | if ([[((NSHTTPURLResponse *)response_) allHeaderFields] objectForKey:@"Content-Length"]) { 64 | response.expectedSize = [[[((NSHTTPURLResponse *)response_) allHeaderFields] objectForKey:@"Content-Length"] integerValue]; 65 | } 66 | response.response = response_; 67 | [fileHandle createFile]; 68 | responseData = [[NSMutableData alloc] init]; 69 | } 70 | 71 | - (void)connection:(NSURLConnection *)connection_ didReceiveData:(NSData *)data_{ 72 | [responseData appendData:data_]; 73 | NSLog(@"%@:download complete %f / 100",fileHandle.writingFilePath,([responseData length]+startOffset)/(float)(response.expectedSize+startOffset) *100.0); 74 | response.downloadRate = ([responseData length]+startOffset)/(float)(response.expectedSize+startOffset); 75 | 76 | if (request.persistentType == SAVE_TO_FILE) { 77 | [fileHandle writeData:data_]; 78 | } 79 | 80 | if (request.callBackType == DELEGATE_TYPE) { 81 | if (delegate && [delegate respondsToSelector:@selector(downloadInprogress:)]) { 82 | [delegate performSelectorOnMainThread:@selector(downloadInprogress:) withObject:response waitUntilDone:NO]; 83 | } 84 | } 85 | else if(request.callBackType == BLOCK_TYPE) { 86 | if (request.inprogressBlock) { 87 | dispatch_async(dispatch_get_main_queue(),^(void){request.inprogressBlock(response);}); 88 | } 89 | } 90 | else{ 91 | 92 | } 93 | 94 | 95 | } 96 | 97 | -(void)connectionDidFinishLoading:(NSURLConnection *)connection_{ 98 | 99 | response.responseData = responseData; 100 | isFinished = YES; 101 | 102 | if (request.callBackType == DELEGATE_TYPE) { 103 | if (delegate && [delegate respondsToSelector:@selector(downloadFinished:)]) { 104 | [delegate performSelectorOnMainThread:@selector(downloadFinished:) withObject:response waitUntilDone:NO]; 105 | 106 | } 107 | } 108 | else if(request.callBackType == BLOCK_TYPE) { 109 | if (request.finishBlock) { 110 | dispatch_async(dispatch_get_main_queue(),^(void){request.finishBlock(response);}); 111 | } 112 | } 113 | else{ 114 | 115 | 116 | } 117 | //connection = nil; 118 | [fileHandle closeFile]; 119 | } 120 | 121 | -(void)connection:(NSURLConnection *)connection_ didFailWithError:(NSError *)error{ 122 | //TDD wap error here 123 | [response setError:error]; 124 | //connection_ = nil; 125 | 126 | if (request.callBackType == DELEGATE_TYPE) { 127 | if (delegate && [delegate respondsToSelector:@selector(downloadFinished:)]) { 128 | [delegate performSelectorOnMainThread:@selector(downloadFinished:) withObject:response waitUntilDone:NO]; 129 | 130 | } 131 | } 132 | else if(request.callBackType == BLOCK_TYPE) { 133 | if (request.finishBlock) { 134 | dispatch_async(dispatch_get_main_queue(),^(void){request.finishBlock(response);}); 135 | 136 | } 137 | } 138 | else{ 139 | 140 | } 141 | 142 | isFinished = YES; 143 | 144 | } 145 | 146 | @end 147 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetion/LWFileHandle.h: -------------------------------------------------------------------------------- 1 | // 2 | // LWFileHandle.h 3 | // LWConnection 4 | // 5 | // Created by 寻 亚楠 on 13-9-2. 6 | // Copyright (c) 2013年 寻 亚楠. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LWRequest.h" 11 | 12 | @class LWRequest; 13 | 14 | @interface LWFileHandle : NSObject{ 15 | 16 | 17 | } 18 | @property (nonatomic,copy) NSString *doneFilePath; 19 | @property (nonatomic,copy) NSString *writingFilePath; 20 | 21 | 22 | - (unsigned long long)getStartOffSetWithPath; 23 | - (id)initWithRequest:(LWRequest*)re; 24 | - (void)createFile; 25 | - (void)writeData:(NSData*)data; 26 | - (void)closeFile; 27 | @end 28 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetion/LWFileHandle.m: -------------------------------------------------------------------------------- 1 | // 2 | // LWFileHandle.m 3 | // LWConnetionDemo 4 | // 5 | // Created by 寻 亚楠 on 13-9-2. 6 | // Copyright (c) 2013年 寻 亚楠. All rights reserved. 7 | // 8 | 9 | #import "LWFileHandle.h" 10 | 11 | @interface LWFileHandle () 12 | @property (nonatomic,LW_STRONG) NSFileManager *manager; 13 | @property (nonatomic,LW_STRONG) NSFileHandle *writeFileHandle; 14 | @property (nonatomic,LW_STRONG) NSFileHandle *readFileHandle; 15 | @property (nonatomic,LW_STRONG) LWRequest *request; 16 | 17 | @end 18 | 19 | @implementation LWFileHandle 20 | @synthesize manager; 21 | @synthesize writeFileHandle; 22 | @synthesize readFileHandle; 23 | @synthesize request; 24 | @synthesize doneFilePath; 25 | @synthesize writingFilePath; 26 | 27 | - (id)initWithRequest:(LWRequest*)re{ 28 | self = [super init]; 29 | if (self) { 30 | self.request = re; 31 | [self setFilePathWithRequestURL:[request.request.URL absoluteString]]; 32 | self.manager = [NSFileManager defaultManager]; 33 | } 34 | return self; 35 | } 36 | - (void)dealloc{ 37 | #if !__has_feature(objc_arc) 38 | [manager release]; 39 | [request release]; 40 | [writeFileHandle release]; 41 | [readFileHandle release]; 42 | [doneFilePath release]; 43 | [writingFilePath release]; 44 | [super dealloc]; 45 | #endif 46 | } 47 | 48 | - (void)writeData:(NSData*)data{ 49 | if (writeFileHandle) { 50 | [writeFileHandle writeData:data]; 51 | } 52 | } 53 | 54 | - (void)closeFile{ 55 | 56 | [readFileHandle closeFile]; 57 | [writeFileHandle closeFile]; 58 | [self fileDone:writingFilePath]; 59 | } 60 | 61 | 62 | - (void) fileDone:(NSString *)path{ 63 | 64 | self.doneFilePath = [path stringByAppendingPathExtension:@"done"]; 65 | NSError *error; 66 | //file exist or not 67 | if ([manager fileExistsAtPath:doneFilePath]) { 68 | [manager removeItemAtPath:doneFilePath error:&error]; 69 | }else{ 70 | NSLog(@"file not exist at path %@",doneFilePath); 71 | } 72 | 73 | if ([manager moveItemAtPath:writingFilePath toPath:doneFilePath error:&error] ){ 74 | 75 | }else{ 76 | NSLog(@"file manger move error %@",error); 77 | } 78 | 79 | 80 | } 81 | 82 | - (NSString *)documentPath { 83 | return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];; 84 | } 85 | 86 | - (void) setFilePathWithRequestURL:(NSString *)url { 87 | NSArray *urlcomponent = [url componentsSeparatedByString:@"/"]; 88 | NSString *fileName = [urlcomponent lastObject]; 89 | self.writingFilePath = [[self documentPath] stringByAppendingPathComponent:fileName]; 90 | self.writeFileHandle = [NSFileHandle fileHandleForWritingAtPath:writingFilePath]; 91 | [writeFileHandle seekToFileOffset:[self getStartOffSetWithPath]]; 92 | 93 | } 94 | - (void)createFile{ 95 | if (![[NSFileManager defaultManager] fileExistsAtPath:writingFilePath]) { 96 | [manager createFileAtPath:writingFilePath contents:nil attributes:nil]; 97 | } 98 | } 99 | 100 | - (unsigned long long)getStartOffSetWithPath{ 101 | if(writingFilePath) 102 | { 103 | if ([[NSFileManager defaultManager] fileExistsAtPath:writingFilePath]) { 104 | self.readFileHandle = [NSFileHandle fileHandleForReadingAtPath:writingFilePath]; 105 | return [[readFileHandle readDataToEndOfFile] length]; 106 | } 107 | else{ 108 | //[manager createFileAtPath:_writingFilePath contents:nil attributes:nil]; 109 | } 110 | } 111 | return 0; 112 | } 113 | 114 | 115 | @end 116 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetion/LWRequest.h: -------------------------------------------------------------------------------- 1 | // 2 | // LWRequest.h 3 | // LWConnection 4 | // 5 | // Created by 寻 亚楠 on 13-8-28. 6 | // Copyright (c) 2013年 寻 亚楠. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //for arc and non-arc 12 | #ifndef LW_STRONG 13 | #if __has_feature(objc_arc) 14 | #define LW_STRONG strong 15 | #else 16 | #define LW_STRONG retain 17 | #endif 18 | #endif 19 | 20 | #ifndef LW_WEAK 21 | #if __has_feature(objc_arc_weak) 22 | #define LW_WEAK weak 23 | #elif __has_feature(objc_arc) 24 | #define LW_WEAK unsafe_unretained 25 | #else 26 | #define LW_WEAK assign 27 | #endif 28 | #endif 29 | 30 | #if __has_feature(objc_arc) 31 | #define LW_AUTORELEASE(exp) exp 32 | #define LW_RELEASE(exp) exp 33 | #define LW_RETAIN(exp) exp 34 | #else 35 | #define LW_AUTORELEASE(exp) [exp autorelease] 36 | #define LW_RELEASE(exp) [exp release] 37 | #define LW_RETAIN(exp) [exp retain] 38 | #endif 39 | 40 | #define DELEGATE_TYPE 0 41 | #define BLOCK_TYPE 1 42 | #define NOT_SAVE 0 43 | #define SAVE_TO_FILE 1 44 | 45 | @class LWConnectionOpertation; 46 | @class LWResponse; 47 | 48 | @protocol LWConnectionDelegate; 49 | typedef void(^didFinishBlock) (LWResponse *re); 50 | typedef void(^inProgressBlock) (LWResponse *re); 51 | 52 | 53 | @interface LWRequest : NSObject 54 | 55 | @property (nonatomic, LW_STRONG) NSString *requestTarget; 56 | @property (nonatomic, LW_STRONG) NSString *requestURL; 57 | @property (nonatomic, LW_STRONG) NSMutableURLRequest*request; 58 | 59 | @property (nonatomic,copy) didFinishBlock finishBlock; 60 | @property (nonatomic,copy) inProgressBlock inprogressBlock; 61 | 62 | @property (nonatomic) int callBackType; 63 | @property (nonatomic) int persistentType; 64 | @property (nonatomic, LW_WEAK) id delegate; 65 | 66 | 67 | - (id)initWithTraget:(NSString *)target requestURL:(NSString *)url delegate:(id)delegate_; 68 | 69 | - (id)initWithTraget:(NSString *)target requestURL:(NSString *)url isPersistance:(BOOL) isPer delegate:(id)delegate_; 70 | 71 | - (id)initWithTarget:(NSString *)target requestURL:(NSString *)url isPersistance:(BOOL) isPer finishHandler:(didFinishBlock)finishBlock_ inProgressHandler:(inProgressBlock)progressBlock_; 72 | 73 | - (id)initWithTarget:(NSString *)target requestURL:(NSString *)url isPersistance:(BOOL) isPer delegate:(id)delegate_ finishHandler:(didFinishBlock)finishBlock_ inProgressHandler:(inProgressBlock)progressBlock_; 74 | 75 | - (void)setFileOffSet:(unsigned long long) startOffset; 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetion/LWRequest.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyRequest.m 3 | // MultDownloader 4 | // 5 | // Created by Marcus on 12/4/12. 6 | // Copyright (c) 2012 Marcus. All rights reserved. 7 | // 8 | 9 | #import "LWRequest.h" 10 | 11 | @interface LWRequest() 12 | 13 | @end 14 | 15 | @implementation LWRequest 16 | 17 | @synthesize requestTarget; 18 | @synthesize request; 19 | @synthesize requestURL; 20 | @synthesize delegate; 21 | @synthesize finishBlock; 22 | @synthesize inprogressBlock; 23 | @synthesize callBackType; 24 | @synthesize persistentType; 25 | 26 | - (id)init { 27 | self = [super init]; 28 | if (self) { 29 | request = [[NSMutableURLRequest alloc] init]; 30 | callBackType = BLOCK_TYPE; 31 | persistentType = NOT_SAVE; 32 | } 33 | return self; 34 | } 35 | 36 | - (void)dealloc{ 37 | #if !__has_feature(objc_arc) 38 | [requestTarget release]; 39 | [requestURL release]; 40 | [request release]; 41 | [finishBlock release]; 42 | [inprogressBlock release]; 43 | [super dealloc]; 44 | #endif 45 | } 46 | 47 | - (id)initWithTraget:(NSString *)target requestURL:(NSString *)url delegate:(id)delegate_{ 48 | 49 | return [self initWithTarget:target requestURL:url isPersistance:NO delegate:delegate_ finishHandler:nil inProgressHandler:nil]; 50 | } 51 | 52 | - (id)initWithTraget:(NSString *)target requestURL:(NSString *)url isPersistance:(BOOL) isPer delegate:(id)delegate_ 53 | { 54 | return [self initWithTarget:target requestURL:url isPersistance:isPer delegate:delegate_ finishHandler:nil inProgressHandler:nil]; 55 | } 56 | 57 | 58 | - (id)initWithTarget:(NSString *)target requestURL:(NSString *)url isPersistance:(BOOL) isPer finishHandler:(didFinishBlock)finishBlock_ inProgressHandler:(inProgressBlock)progressBlock_ 59 | { 60 | return [self initWithTarget:target requestURL:url isPersistance:isPer delegate:nil finishHandler:finishBlock_ inProgressHandler:progressBlock_]; 61 | } 62 | 63 | - (id)initWithTarget:(NSString *)target requestURL:(NSString *)url isPersistance:(BOOL) isPer delegate:(id)delegate_ finishHandler:(didFinishBlock)finishBlock_ inProgressHandler:(inProgressBlock)progressBlock_{ 64 | self = [super init]; 65 | if (self) { 66 | request = [[NSMutableURLRequest alloc] init]; 67 | request.URL = [NSURL URLWithString:url]; 68 | if (isPer) { 69 | persistentType = SAVE_TO_FILE; 70 | }else{ 71 | persistentType = NOT_SAVE; 72 | } 73 | self.requestTarget = target; 74 | 75 | if (delegate_) { 76 | delegate = delegate_; 77 | callBackType = DELEGATE_TYPE; 78 | } 79 | else { 80 | self.finishBlock = finishBlock_; 81 | self.inprogressBlock = progressBlock_; 82 | callBackType = BLOCK_TYPE; 83 | } 84 | } 85 | return self; 86 | } 87 | 88 | 89 | - (void)setFileOffSet:(unsigned long long) startOffset { 90 | NSString *rangeValue = [NSString stringWithFormat:@"bytes=%llu-",startOffset]; 91 | [request setValue:rangeValue forHTTPHeaderField:@"Range"]; 92 | } 93 | 94 | - (NSString *)description { 95 | return [NSString stringWithFormat:@"requets url is %@, header is %@",request.URL.absoluteString, [request allHTTPHeaderFields]]; 96 | } 97 | 98 | 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetion/LWResponse.h: -------------------------------------------------------------------------------- 1 | // 2 | // LWResponse.h 3 | // LWConnection 4 | // 5 | // Created by 寻 亚楠 on 13-8-28. 6 | // Copyright (c) 2013年 寻 亚楠. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LWRequest.h" 11 | 12 | @interface LWResponse : NSObject 13 | 14 | @property (nonatomic, copy) NSString *responseTarget; 15 | @property (nonatomic, LW_STRONG) NSData *responseData; 16 | @property (nonatomic) int expectedSize; 17 | @property (nonatomic, LW_STRONG) NSError *error; 18 | @property (nonatomic) float downloadRate; 19 | @property (nonatomic, LW_STRONG) NSURLResponse *response; 20 | 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetion/LWResponse.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyResponse.m 3 | // MultDownloader 4 | // 5 | // Created by Marcus on 12/4/12. 6 | // Copyright (c) 2012 Marcus. All rights reserved. 7 | // 8 | 9 | #import "LWResponse.h" 10 | 11 | @implementation LWResponse 12 | 13 | @synthesize responseTarget; 14 | @synthesize responseData; 15 | @synthesize expectedSize; 16 | @synthesize error; 17 | @synthesize downloadRate; 18 | @synthesize response; 19 | 20 | 21 | - (id)init{ 22 | self = [super init]; 23 | if (self) { 24 | 25 | } 26 | return self; 27 | } 28 | 29 | - (void)dealloc{ 30 | #if !__has_feature(objc_arc) 31 | [responseTarget release]; 32 | [responseData release]; 33 | [error release]; 34 | [response release]; 35 | [super dealloc]; 36 | #endif 37 | } 38 | 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetionDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | xun.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/LWConnetionDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'LWConnetionDemo' target in the 'LWConnetionDemo' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LWConnetionDemo/LWConnetionDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LWConnetionDemo 4 | // 5 | // Created by 寻 亚楠 on 13-8-28. 6 | // Copyright (c) 2013年 寻 亚楠. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | LWConnetionDemo 2 | =============== 3 | 4 | LWConnetion is a ligth weight connetion that is used to send a URL request on the network, It's defference from the ASIHTTPReqeust 5 | and based on NSURLConnetion more simple and easy. Of cousre It's not as huge as ASIHTTPRequest ,just the simple copacity as below: 6 | 7 | 1 multi-thread and concurrent. 8 | 2 save response and data on the local file. 9 | 3 support ARC and NON-ARC. 10 | --------------------------------------------------------------------------------