Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 779
Steven Fisher Avatar asked Oct 17 '11 19:10

Steven Fisher


2 Answers

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.

like image 60
amosel Avatar answered Sep 17 '22 17:09

amosel


You can use the Other Linker Flags build setting to link in the library, and specialize the value based on whether it's "Any iOS" or "Any iOS Simulator".

like image 44
Lily Ballard Avatar answered Sep 21 '22 17:09

Lily Ballard