Search code examples
cocoa-touchios5ios4binary-compatibility

Conditionally linking for @autoreleasepool


When I try to run my application in the iOS 4.3 simulator (Xcode 4.2), I crash when I hit @autoreleasepool{}, with:

dyld: lazy symbol binding failed: Symbol not found: _objc_autoreleasePoolPush

I looked around, and I see the workaround is to add libarclite_iphoneos.a. There's a version of this for the simulator, too, as libarclite_iphonesimulator.a.

I need to add both libraries to my project to make it run on both the simulator and hardware. But whichever I build, it complains that the other library is for an unsupported architecture.

For example, building for simulator:

ld: warning: ignoring file /Developer-4.2/Platforms/iPhoneOS.platform/
Developer/usr/lib/arc/libarclite_iphoneos.a, missing required architecture
i386 in file

How do I fix both of these simultaneously? Or should I just stick with the old NSAutoreleasePool syntax for now?


Solution

  • After a trials like clean, clean folder, resetting iPhone Simulator and even a restart, I changed the IPHONE_DEPLYMENT_TARGET on the target build setting down from iOS 5.0 to iOS 4.2. Worked.