What version of iOS is required to use @autoreleasepool?

When I run the code using the @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 was just a replacement for explicitly creating / deleting the autorelease pool. In any case, this is not so, and he was mistaken. Is this only supported on a specific version of iOS? So where can I check the version information of this keyword?

+6
source share
3 answers

Do you mean @autoreleasepool?

You can use @autoreleasepool in the app to build iOS 4.3.x if you are using Xcode 4.2 and the iOS 5 SDK. Despite moving to ARC guidelines , stating that "ARC introduces the statement construct in Objective-C grammar" in @autoreleasepool, which ARC has to offer, it goes on to say: "This syntax is available in all Objective-C modes."

Although I don't think the documentation is particularly clear, this means that you can use @autoreleasepool syntax with or without ARC if you use the iOS 5 SDK.

+4
source

just tested @autoreleasepool {} on the first generation iPhone running iOS3.0 - works without problems

+3
source

This seems to be a bug in the simulator.

Setting the deployment target in 4.2 instead of 4.2.1 worked for me.

enter image description here

+3
source

Source: https://habr.com/ru/post/903254/


All Articles