有条件地链接 @autoreleasepool
当我尝试在 iOS 4.3 模拟器 (Xcode 4.2) 中运行我的应用程序时,当我点击 @autoreleasepool{} 时,我崩溃了:
dyld: lazy symbol binding failed: Symbol not found: _objc_autoreleasePoolPush
我环顾四周,发现解决方法是添加 libarclite_iphoneos.a
。模拟器也有一个版本,如 libarclite_iphonesimulator.a
。
我需要将这两个库添加到我的项目中,以使其在模拟器和硬件上运行。但无论我构建哪个,它都会抱怨另一个库适用于不受支持的架构。
例如,构建模拟器:
ld: warning: ignoring file /Developer-4.2/Platforms/iPhoneOS.platform/
Developer/usr/lib/arc/libarclite_iphoneos.a, missing required architecture
i386 in file
如何同时修复这两个问题?或者我现在应该坚持使用旧的 NSAutoreleasePool 语法?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
经过清理、清理文件夹、重置 iPhone Simulator 甚至重新启动等试验后,我将目标构建设置上的 IPHONE_DEPLYMENT_TARGET 从 iOS 5.0 更改为 iOS 4.2。
工作了。
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.
您可以使用“其他链接器标志”构建设置在库中进行链接,并根据它是“任何 iOS”还是“任何 iOS 模拟器”来专门化该值。
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".
您还可以将两个静态库合并为一个通用库。转到终端并说
您可以通过说(在终端中)验证结果文件
它应该输出:
由于此库是静态链接的,因此您的最终应用程序不会因为包含的 sim 库而增长,因为只有您的应用程序需要的内容才会得到链接到您的最终应用程序。
You can also merge the two static libraries to one universal library. Go to the Terminal and say
You can verify the resulting file by saying (in Terminal)
It should output:
Since this lib is linked statically, your final app wont grow because of the included sim library since only whatever is needed by your app will get linked into your final app.