当我在iOS 4.3.x上使用@autorelease关键字运行代码时,它会抛出此错误.
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
我认为关键字只是替代显式自动释放池创建/删除.无论如何它不是,并抛出一个错误.它仅支持特定版本的iOS吗?那么在哪里可以查看关键字的版本信息?
解决方法
你指的是@autoreleasepool吗?
如果您使用的是Xcode 4.2和iOS 5 SDK,则可以在具有iOS 4.3.x构建目标的应用程序中使用@autoreleasepool.尽管transitioning to ARC guidelines在@autoreleasepool中声明“ARC为Objective-C语法引入了一个语句结构”,这可能暗示ARC是必需的,但它继续说,“这种语法在所有Objective-C模式中都可用.”
虽然我不认为这是特别清晰的文档,但这意味着如果你使用iOS 5 SDK,你可以使用带有和不带ARC的@autoreleasepool语法.