Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What iOS version is required to use @autoreleasepool?

When I run code using @autorelease keyword on iOS 4.3.x it throws this error.

dyld: lazy symbol binding failed: Symbol not found: _objc_autoreleasePoolPush
  Referenced from: /Users/Eonil/Library/Application Support/iPhone Simulator/4.3.2/Applications/3782382E-293A-4D5E-86E6-28BE35CF6048/EonilCocoaComplementsTester.app/EonilCocoaComplementsTester
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation

dyld: Symbol not found: _objc_autoreleasePoolPush
  Referenced from: /Users/Eonil/Library/Application Support/iPhone Simulator/4.3.2/Applications/3782382E-293A-4D5E-86E6-28BE35CF6048/EonilCocoaComplementsTester.app/EonilCocoaComplementsTester
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation

I thought the keyword is just replacement of explicit autorelease-pool creation/deletion. Anyway it wasn't, and threw an error. Does it supported only in specific version of iOS? So where can I check the version information about this keyword?

like image 212
eonil Avatar asked Dec 07 '11 05:12

eonil


1 Answers

Are you referring to @autoreleasepool?

You can use @autoreleasepool in an app with a build target of iOS 4.3.x if you are using Xcode 4.2 and the iOS 5 SDK. Despite the transitioning to ARC guidelines stating that "ARC introduces a statement construct to the Objective-C grammar" in @autoreleasepool, which might suggest ARC is required, it goes on to say that, "This syntax is available in all Objective-C modes."

While I don't think that's particularly clear documentation, what this means is that you can use the @autoreleasepool syntax both with and without ARC—if you're using the iOS 5 SDK.

like image 186
Duncan Babbage Avatar answered Nov 09 '22 15:11

Duncan Babbage