├── .gitignore ├── AutoreleasePool.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── AutoreleasePool ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── AutoreleasePoolTests ├── AutoreleasePoolTests.m └── Info.plist ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /AutoreleasePool.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2438D4281B19561D00A8F3E7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2438D4271B19561D00A8F3E7 /* main.m */; }; 11 | 2438D42B1B19561D00A8F3E7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2438D42A1B19561D00A8F3E7 /* AppDelegate.m */; }; 12 | 2438D42E1B19561D00A8F3E7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2438D42D1B19561D00A8F3E7 /* ViewController.m */; }; 13 | 2438D4311B19561D00A8F3E7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2438D42F1B19561D00A8F3E7 /* Main.storyboard */; }; 14 | 2438D4331B19561D00A8F3E7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2438D4321B19561D00A8F3E7 /* Images.xcassets */; }; 15 | 2438D4361B19561D00A8F3E7 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2438D4341B19561D00A8F3E7 /* LaunchScreen.xib */; }; 16 | 2438D4421B19561D00A8F3E7 /* AutoreleasePoolTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2438D4411B19561D00A8F3E7 /* AutoreleasePoolTests.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 2438D43C1B19561D00A8F3E7 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 2438D41A1B19561D00A8F3E7 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 2438D4211B19561D00A8F3E7; 25 | remoteInfo = AutoreleasePool; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 2438D4221B19561D00A8F3E7 /* AutoreleasePool.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AutoreleasePool.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 2438D4261B19561D00A8F3E7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 2438D4271B19561D00A8F3E7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 33 | 2438D4291B19561D00A8F3E7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 34 | 2438D42A1B19561D00A8F3E7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 35 | 2438D42C1B19561D00A8F3E7 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 36 | 2438D42D1B19561D00A8F3E7 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 37 | 2438D4301B19561D00A8F3E7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 38 | 2438D4321B19561D00A8F3E7 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 39 | 2438D4351B19561D00A8F3E7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 40 | 2438D43B1B19561D00A8F3E7 /* AutoreleasePoolTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AutoreleasePoolTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 2438D4401B19561D00A8F3E7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 2438D4411B19561D00A8F3E7 /* AutoreleasePoolTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AutoreleasePoolTests.m; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 2438D41F1B19561D00A8F3E7 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | 2438D4381B19561D00A8F3E7 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | 2438D4191B19561D00A8F3E7 = { 64 | isa = PBXGroup; 65 | children = ( 66 | 2438D4241B19561D00A8F3E7 /* AutoreleasePool */, 67 | 2438D43E1B19561D00A8F3E7 /* AutoreleasePoolTests */, 68 | 2438D4231B19561D00A8F3E7 /* Products */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | 2438D4231B19561D00A8F3E7 /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 2438D4221B19561D00A8F3E7 /* AutoreleasePool.app */, 76 | 2438D43B1B19561D00A8F3E7 /* AutoreleasePoolTests.xctest */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | 2438D4241B19561D00A8F3E7 /* AutoreleasePool */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 2438D4291B19561D00A8F3E7 /* AppDelegate.h */, 85 | 2438D42A1B19561D00A8F3E7 /* AppDelegate.m */, 86 | 2438D42C1B19561D00A8F3E7 /* ViewController.h */, 87 | 2438D42D1B19561D00A8F3E7 /* ViewController.m */, 88 | 2438D42F1B19561D00A8F3E7 /* Main.storyboard */, 89 | 2438D4321B19561D00A8F3E7 /* Images.xcassets */, 90 | 2438D4341B19561D00A8F3E7 /* LaunchScreen.xib */, 91 | 2438D4251B19561D00A8F3E7 /* Supporting Files */, 92 | ); 93 | path = AutoreleasePool; 94 | sourceTree = ""; 95 | }; 96 | 2438D4251B19561D00A8F3E7 /* Supporting Files */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 2438D4261B19561D00A8F3E7 /* Info.plist */, 100 | 2438D4271B19561D00A8F3E7 /* main.m */, 101 | ); 102 | name = "Supporting Files"; 103 | sourceTree = ""; 104 | }; 105 | 2438D43E1B19561D00A8F3E7 /* AutoreleasePoolTests */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 2438D4411B19561D00A8F3E7 /* AutoreleasePoolTests.m */, 109 | 2438D43F1B19561D00A8F3E7 /* Supporting Files */, 110 | ); 111 | path = AutoreleasePoolTests; 112 | sourceTree = ""; 113 | }; 114 | 2438D43F1B19561D00A8F3E7 /* Supporting Files */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 2438D4401B19561D00A8F3E7 /* Info.plist */, 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 2438D4211B19561D00A8F3E7 /* AutoreleasePool */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 2438D4451B19561D00A8F3E7 /* Build configuration list for PBXNativeTarget "AutoreleasePool" */; 128 | buildPhases = ( 129 | 2438D41E1B19561D00A8F3E7 /* Sources */, 130 | 2438D41F1B19561D00A8F3E7 /* Frameworks */, 131 | 2438D4201B19561D00A8F3E7 /* Resources */, 132 | ); 133 | buildRules = ( 134 | ); 135 | dependencies = ( 136 | ); 137 | name = AutoreleasePool; 138 | productName = AutoreleasePool; 139 | productReference = 2438D4221B19561D00A8F3E7 /* AutoreleasePool.app */; 140 | productType = "com.apple.product-type.application"; 141 | }; 142 | 2438D43A1B19561D00A8F3E7 /* AutoreleasePoolTests */ = { 143 | isa = PBXNativeTarget; 144 | buildConfigurationList = 2438D4481B19561D00A8F3E7 /* Build configuration list for PBXNativeTarget "AutoreleasePoolTests" */; 145 | buildPhases = ( 146 | 2438D4371B19561D00A8F3E7 /* Sources */, 147 | 2438D4381B19561D00A8F3E7 /* Frameworks */, 148 | 2438D4391B19561D00A8F3E7 /* Resources */, 149 | ); 150 | buildRules = ( 151 | ); 152 | dependencies = ( 153 | 2438D43D1B19561D00A8F3E7 /* PBXTargetDependency */, 154 | ); 155 | name = AutoreleasePoolTests; 156 | productName = AutoreleasePoolTests; 157 | productReference = 2438D43B1B19561D00A8F3E7 /* AutoreleasePoolTests.xctest */; 158 | productType = "com.apple.product-type.bundle.unit-test"; 159 | }; 160 | /* End PBXNativeTarget section */ 161 | 162 | /* Begin PBXProject section */ 163 | 2438D41A1B19561D00A8F3E7 /* Project object */ = { 164 | isa = PBXProject; 165 | attributes = { 166 | LastUpgradeCheck = 0630; 167 | ORGANIZATIONNAME = leichunfeng; 168 | TargetAttributes = { 169 | 2438D4211B19561D00A8F3E7 = { 170 | CreatedOnToolsVersion = 6.3.1; 171 | }; 172 | 2438D43A1B19561D00A8F3E7 = { 173 | CreatedOnToolsVersion = 6.3.1; 174 | TestTargetID = 2438D4211B19561D00A8F3E7; 175 | }; 176 | }; 177 | }; 178 | buildConfigurationList = 2438D41D1B19561D00A8F3E7 /* Build configuration list for PBXProject "AutoreleasePool" */; 179 | compatibilityVersion = "Xcode 3.2"; 180 | developmentRegion = English; 181 | hasScannedForEncodings = 0; 182 | knownRegions = ( 183 | en, 184 | Base, 185 | ); 186 | mainGroup = 2438D4191B19561D00A8F3E7; 187 | productRefGroup = 2438D4231B19561D00A8F3E7 /* Products */; 188 | projectDirPath = ""; 189 | projectRoot = ""; 190 | targets = ( 191 | 2438D4211B19561D00A8F3E7 /* AutoreleasePool */, 192 | 2438D43A1B19561D00A8F3E7 /* AutoreleasePoolTests */, 193 | ); 194 | }; 195 | /* End PBXProject section */ 196 | 197 | /* Begin PBXResourcesBuildPhase section */ 198 | 2438D4201B19561D00A8F3E7 /* Resources */ = { 199 | isa = PBXResourcesBuildPhase; 200 | buildActionMask = 2147483647; 201 | files = ( 202 | 2438D4311B19561D00A8F3E7 /* Main.storyboard in Resources */, 203 | 2438D4361B19561D00A8F3E7 /* LaunchScreen.xib in Resources */, 204 | 2438D4331B19561D00A8F3E7 /* Images.xcassets in Resources */, 205 | ); 206 | runOnlyForDeploymentPostprocessing = 0; 207 | }; 208 | 2438D4391B19561D00A8F3E7 /* Resources */ = { 209 | isa = PBXResourcesBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | }; 215 | /* End PBXResourcesBuildPhase section */ 216 | 217 | /* Begin PBXSourcesBuildPhase section */ 218 | 2438D41E1B19561D00A8F3E7 /* Sources */ = { 219 | isa = PBXSourcesBuildPhase; 220 | buildActionMask = 2147483647; 221 | files = ( 222 | 2438D42E1B19561D00A8F3E7 /* ViewController.m in Sources */, 223 | 2438D42B1B19561D00A8F3E7 /* AppDelegate.m in Sources */, 224 | 2438D4281B19561D00A8F3E7 /* main.m in Sources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | 2438D4371B19561D00A8F3E7 /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 2438D4421B19561D00A8F3E7 /* AutoreleasePoolTests.m in Sources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXSourcesBuildPhase section */ 237 | 238 | /* Begin PBXTargetDependency section */ 239 | 2438D43D1B19561D00A8F3E7 /* PBXTargetDependency */ = { 240 | isa = PBXTargetDependency; 241 | target = 2438D4211B19561D00A8F3E7 /* AutoreleasePool */; 242 | targetProxy = 2438D43C1B19561D00A8F3E7 /* PBXContainerItemProxy */; 243 | }; 244 | /* End PBXTargetDependency section */ 245 | 246 | /* Begin PBXVariantGroup section */ 247 | 2438D42F1B19561D00A8F3E7 /* Main.storyboard */ = { 248 | isa = PBXVariantGroup; 249 | children = ( 250 | 2438D4301B19561D00A8F3E7 /* Base */, 251 | ); 252 | name = Main.storyboard; 253 | sourceTree = ""; 254 | }; 255 | 2438D4341B19561D00A8F3E7 /* LaunchScreen.xib */ = { 256 | isa = PBXVariantGroup; 257 | children = ( 258 | 2438D4351B19561D00A8F3E7 /* Base */, 259 | ); 260 | name = LaunchScreen.xib; 261 | sourceTree = ""; 262 | }; 263 | /* End PBXVariantGroup section */ 264 | 265 | /* Begin XCBuildConfiguration section */ 266 | 2438D4431B19561D00A8F3E7 /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ALWAYS_SEARCH_USER_PATHS = NO; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_WARN_BOOL_CONVERSION = YES; 275 | CLANG_WARN_CONSTANT_CONVERSION = YES; 276 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 277 | CLANG_WARN_EMPTY_BODY = YES; 278 | CLANG_WARN_ENUM_CONVERSION = YES; 279 | CLANG_WARN_INT_CONVERSION = YES; 280 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 281 | CLANG_WARN_UNREACHABLE_CODE = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 284 | COPY_PHASE_STRIP = NO; 285 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 286 | ENABLE_STRICT_OBJC_MSGSEND = YES; 287 | GCC_C_LANGUAGE_STANDARD = gnu99; 288 | GCC_DYNAMIC_NO_PIC = NO; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_OPTIMIZATION_LEVEL = 0; 291 | GCC_PREPROCESSOR_DEFINITIONS = ( 292 | "DEBUG=1", 293 | "$(inherited)", 294 | ); 295 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 296 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 297 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 298 | GCC_WARN_UNDECLARED_SELECTOR = YES; 299 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 300 | GCC_WARN_UNUSED_FUNCTION = YES; 301 | GCC_WARN_UNUSED_VARIABLE = YES; 302 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 303 | MTL_ENABLE_DEBUG_INFO = YES; 304 | ONLY_ACTIVE_ARCH = YES; 305 | SDKROOT = iphoneos; 306 | }; 307 | name = Debug; 308 | }; 309 | 2438D4441B19561D00A8F3E7 /* Release */ = { 310 | isa = XCBuildConfiguration; 311 | buildSettings = { 312 | ALWAYS_SEARCH_USER_PATHS = NO; 313 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 314 | CLANG_CXX_LIBRARY = "libc++"; 315 | CLANG_ENABLE_MODULES = YES; 316 | CLANG_ENABLE_OBJC_ARC = YES; 317 | CLANG_WARN_BOOL_CONVERSION = YES; 318 | CLANG_WARN_CONSTANT_CONVERSION = YES; 319 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 320 | CLANG_WARN_EMPTY_BODY = YES; 321 | CLANG_WARN_ENUM_CONVERSION = YES; 322 | CLANG_WARN_INT_CONVERSION = YES; 323 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 324 | CLANG_WARN_UNREACHABLE_CODE = YES; 325 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 326 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 327 | COPY_PHASE_STRIP = NO; 328 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 329 | ENABLE_NS_ASSERTIONS = NO; 330 | ENABLE_STRICT_OBJC_MSGSEND = YES; 331 | GCC_C_LANGUAGE_STANDARD = gnu99; 332 | GCC_NO_COMMON_BLOCKS = YES; 333 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 334 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 335 | GCC_WARN_UNDECLARED_SELECTOR = YES; 336 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 337 | GCC_WARN_UNUSED_FUNCTION = YES; 338 | GCC_WARN_UNUSED_VARIABLE = YES; 339 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 340 | MTL_ENABLE_DEBUG_INFO = NO; 341 | SDKROOT = iphoneos; 342 | VALIDATE_PRODUCT = YES; 343 | }; 344 | name = Release; 345 | }; 346 | 2438D4461B19561D00A8F3E7 /* Debug */ = { 347 | isa = XCBuildConfiguration; 348 | buildSettings = { 349 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 350 | INFOPLIST_FILE = AutoreleasePool/Info.plist; 351 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 352 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 353 | PRODUCT_NAME = "$(TARGET_NAME)"; 354 | }; 355 | name = Debug; 356 | }; 357 | 2438D4471B19561D00A8F3E7 /* Release */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 361 | INFOPLIST_FILE = AutoreleasePool/Info.plist; 362 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 363 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 364 | PRODUCT_NAME = "$(TARGET_NAME)"; 365 | }; 366 | name = Release; 367 | }; 368 | 2438D4491B19561D00A8F3E7 /* Debug */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | BUNDLE_LOADER = "$(TEST_HOST)"; 372 | FRAMEWORK_SEARCH_PATHS = ( 373 | "$(SDKROOT)/Developer/Library/Frameworks", 374 | "$(inherited)", 375 | ); 376 | GCC_PREPROCESSOR_DEFINITIONS = ( 377 | "DEBUG=1", 378 | "$(inherited)", 379 | ); 380 | INFOPLIST_FILE = AutoreleasePoolTests/Info.plist; 381 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AutoreleasePool.app/AutoreleasePool"; 384 | }; 385 | name = Debug; 386 | }; 387 | 2438D44A1B19561D00A8F3E7 /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | BUNDLE_LOADER = "$(TEST_HOST)"; 391 | FRAMEWORK_SEARCH_PATHS = ( 392 | "$(SDKROOT)/Developer/Library/Frameworks", 393 | "$(inherited)", 394 | ); 395 | INFOPLIST_FILE = AutoreleasePoolTests/Info.plist; 396 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 397 | PRODUCT_NAME = "$(TARGET_NAME)"; 398 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AutoreleasePool.app/AutoreleasePool"; 399 | }; 400 | name = Release; 401 | }; 402 | /* End XCBuildConfiguration section */ 403 | 404 | /* Begin XCConfigurationList section */ 405 | 2438D41D1B19561D00A8F3E7 /* Build configuration list for PBXProject "AutoreleasePool" */ = { 406 | isa = XCConfigurationList; 407 | buildConfigurations = ( 408 | 2438D4431B19561D00A8F3E7 /* Debug */, 409 | 2438D4441B19561D00A8F3E7 /* Release */, 410 | ); 411 | defaultConfigurationIsVisible = 0; 412 | defaultConfigurationName = Release; 413 | }; 414 | 2438D4451B19561D00A8F3E7 /* Build configuration list for PBXNativeTarget "AutoreleasePool" */ = { 415 | isa = XCConfigurationList; 416 | buildConfigurations = ( 417 | 2438D4461B19561D00A8F3E7 /* Debug */, 418 | 2438D4471B19561D00A8F3E7 /* Release */, 419 | ); 420 | defaultConfigurationIsVisible = 0; 421 | defaultConfigurationName = Release; 422 | }; 423 | 2438D4481B19561D00A8F3E7 /* Build configuration list for PBXNativeTarget "AutoreleasePoolTests" */ = { 424 | isa = XCConfigurationList; 425 | buildConfigurations = ( 426 | 2438D4491B19561D00A8F3E7 /* Debug */, 427 | 2438D44A1B19561D00A8F3E7 /* Release */, 428 | ); 429 | defaultConfigurationIsVisible = 0; 430 | defaultConfigurationName = Release; 431 | }; 432 | /* End XCConfigurationList section */ 433 | }; 434 | rootObject = 2438D41A1B19561D00A8F3E7 /* Project object */; 435 | } 436 | -------------------------------------------------------------------------------- /AutoreleasePool.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AutoreleasePool/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AutoreleasePool 4 | // 5 | // Created by leichunfeng on 15/5/30. 6 | // Copyright (c) 2015年 leichunfeng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /AutoreleasePool/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AutoreleasePool 4 | // 5 | // Created by leichunfeng on 15/5/30. 6 | // Copyright (c) 2015年 leichunfeng. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // 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. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 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 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /AutoreleasePool/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /AutoreleasePool/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 | -------------------------------------------------------------------------------- /AutoreleasePool/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" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /AutoreleasePool/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.leichunfeng.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /AutoreleasePool/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AutoreleasePool 4 | // 5 | // Created by leichunfeng on 15/5/30. 6 | // Copyright (c) 2015年 leichunfeng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /AutoreleasePool/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // AutoreleasePool 4 | // 5 | // Created by leichunfeng on 15/5/30. 6 | // Copyright (c) 2015年 leichunfeng. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @implementation ViewController 12 | 13 | __weak NSString *string_weak_ = nil; 14 | 15 | - (void)viewDidLoad { 16 | [super viewDidLoad]; 17 | 18 | // 场景 1 19 | NSString *string = [NSString stringWithFormat:@"leichunfeng"]; 20 | string_weak_ = string; 21 | 22 | // 场景 2 23 | // @autoreleasepool { 24 | // NSString *string = [NSString stringWithFormat:@"leichunfeng"]; 25 | // string_weak_ = string; 26 | // } 27 | 28 | // 场景 3 29 | // NSString *string = nil; 30 | // @autoreleasepool { 31 | // string = [NSString stringWithFormat:@"leichunfeng"]; 32 | // string_weak_ = string; 33 | // } 34 | 35 | NSLog(@"string: %@", string_weak_); 36 | } 37 | 38 | - (void)viewWillAppear:(BOOL)animated { 39 | [super viewWillAppear:animated]; 40 | NSLog(@"string: %@", string_weak_); 41 | } 42 | 43 | - (void)viewDidAppear:(BOOL)animated { 44 | [super viewDidAppear:animated]; 45 | NSLog(@"string: %@", string_weak_); 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /AutoreleasePool/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AutoreleasePool 4 | // 5 | // Created by leichunfeng on 15/5/30. 6 | // Copyright (c) 2015年 leichunfeng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /AutoreleasePoolTests/AutoreleasePoolTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AutoreleasePoolTests.m 3 | // AutoreleasePoolTests 4 | // 5 | // Created by leichunfeng on 15/5/30. 6 | // Copyright (c) 2015年 leichunfeng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface AutoreleasePoolTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation AutoreleasePoolTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /AutoreleasePoolTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.leichunfeng.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 leichunfeng 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. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoreleasePool 2 | 3 | 我的博文[《Objective-C Autorelease Pool 的实现原理》](http://blog.leichunfeng.com/blog/2015/05/31/objective-c-autorelease-pool-implementation-principle/)的完整配套代码。 4 | 5 | ``` objc 6 | __weak NSString *string_weak_ = nil; 7 | 8 | - (void)viewDidLoad { 9 | [super viewDidLoad]; 10 | 11 | // 场景 1 12 | NSString *string = [NSString stringWithFormat:@"leichunfeng"]; 13 | string_weak_ = string; 14 | 15 | // 场景 2 16 | // @autoreleasepool { 17 | // NSString *string = [NSString stringWithFormat:@"leichunfeng"]; 18 | // string_weak_ = string; 19 | // } 20 | 21 | // 场景 3 22 | // NSString *string = nil; 23 | // @autoreleasepool { 24 | // string = [NSString stringWithFormat:@"leichunfeng"]; 25 | // string_weak_ = string; 26 | // } 27 | 28 | NSLog(@"string: %@", string_weak_); 29 | } 30 | 31 | - (void)viewWillAppear:(BOOL)animated { 32 | [super viewWillAppear:animated]; 33 | NSLog(@"string: %@", string_weak_); 34 | } 35 | 36 | - (void)viewDidAppear:(BOOL)animated { 37 | [super viewDidAppear:animated]; 38 | NSLog(@"string: %@", string_weak_); 39 | } 40 | ``` 41 | --------------------------------------------------------------------------------