xcode iOS 4.3 上的 libobjc.A.dylib 编译错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8112035/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:24:40  来源:igfitidea点击:

libobjc.A.dylib compile error on iOS 4.3

iosxcode

提问by oberbaum

I'm having a compiling error in iOS Simulator 4.3 I can't actually figure it out, The error I get is:

我在 iOS Simulator 4.3 中遇到编译错误我实际上无法弄清楚,我得到的错误是:

dyld: lazy symbol binding failed: Symbol not found: _objc_retain
  Referenced from: /Users/ben/Library/Application Support/iPhone Simulator/4.3.2/Applications/75915A97-7C3D-489A-B7B0-7B6895A4B584/AppName.app/AppName
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libobjc.A.dylib

dyld: Symbol not found: _objc_retain
  Referenced from: /Users/ben/Library/Application Support/iPhone Simulator/4.3.2/Applications/75915A97-7C3D-489A-B7B0-7B6895A4B584/AppName.app/AppName
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libobjc.A.dylib

Note:
The library being referenced (libobjc.A.dylib) is actually in the 'Expected Place' The code works fine on an iOS5 device, and in iOS5 Simulator.

注意:
被引用的库 (libobjc.A.dylib) 实际上在“预期位置”中。代码在 iOS5 设备和 iOS5 模拟器上运行良好。

回答by Jerapong Nampetch

Add -fobjc-arcin Build Settings => Other Linker Flags (OTHER_LDFLAGS) for the different configurations

为不同的配置添加-fobjc-arcBuild Settings => Other Linker Flags ( OTHER_LDFLAGS)

回答by Md Mahbubur Rahman

This problem occurs if you use a library that uses ARC and want to build/run on older iOS 4 devices.

如果您使用使用 ARC 的库并希望在较旧的 iOS 4 设备上构建/运行,则会出现此问题。

In Build Settings => Other Linker Flags

在构建设置 => 其他链接器标志

  • Add -fobjc-arc
  • If yet not solved, then add -weak_library /usr/lib/libobjc.A.dylib
  • 添加 -fobjc-arc
  • 如果还没有解决,则添加 -weak_library /usr/lib/libobjc.A.dylib