简体   繁体   English

静态库(ARC)在非ARC应用程序上工作,遇到错误:dyld:惰性符号绑定失败:未找到符号:_objc_retainAutoreleasedReturnValue

[英]Static library(ARC) work on non ARC app, met error: dyld: lazy symbol binding failed: Symbol not found: _objc_retainAutoreleasedReturnValue

Xcode 4.3.2 I wrote a static library, using ARC. Xcode 4.3.2我使用ARC编写了一个静态库。

When I put it into a project, and test on iOS 4.3 simulator. 当我将其放入项目中并在iOS 4.3模拟器上进行测试时。 (base on iOS 5.1, deploy target 4.3) (基于iOS 5.1,部署目标4.3)

If the project using ARC, it works fine. 如果项目使用ARC,则可以正常工作。

If the project not using ARC, met errors, such as: 如果项目未使用ARC,则遇到错误,例如:

dyld: lazy symbol binding failed: Symbol not found: _objc_retainAutoreleasedReturnValue Referenced from: /Users/cnzzmobile/Library/Application Support/iPhone Simulator/4.3.2/Applications/A4EEB0A0-AC16-402C-B426-46667225F66D/test.app/test Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation dyld:懒惰的符号绑定失败:找不到符号:_objc_retainAutoreleasedReturnValue引用自:/ Users / cnzzmobile / Library / Application Support / iPhone Simulator / 4.3.2 / Applications / A4EEB0A0-AC16-402C-B426-46667225F66D / test.app / test位于:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation

dyld: Symbol not found: _objc_retainAutoreleasedReturnValue Referenced from: /Users/cnzzmobile/Library/Application Support/iPhone Simulator/4.3.2/Applications/A4EEB0A0-AC16-402C-B426-46667225F66D/test.app/test Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation dyld:未找到符号:_objc_retainAutoreleasedReturnValue引用自:/ Users / cnzzmobile / Library / Application Support / iPhone Simulator / 4.3.2 / Applications / A4EEB0A0-AC16-402C-B426-46667225F66D / test.app / test预期在:/ Applications / Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation

I searched a lot, but can't find an answer can solve this problem. 我进行了很多搜索,但找不到答案可以解决此问题。

I remove jsonobjcet which only supported by iOS5, and -fobjc-arc also doesn't work. 我删除了仅受iOS5支持的jsonobjcet,并且-fobjc-arc也无效。

Thanks 谢谢

I found add "-fobjc-arc" at "other linker flag" can solve this problem on Xcode 4.3.2 based on iOS 5.1. 我发现在“其他链接器标志”处添加“ -fobjc-arc”可以解决基于iOS 5.1的Xcode 4.3.2上的此问题。 Because the xcode can't find the lib which support ARC to link. 因为xcode找不到支持ARC链接的库。

Notice that: add "-fobjc-arc" at "other linker flag" not at "Compile sources". 请注意:在“其他链接器标志”而不是“编译源代码”处添加“ -fobjc-arc”。

But this still doesn't work on old version Xcode 4(snow leopard) based on iOS 4.3. 但这仍不适用于基于iOS 4.3的旧版本Xcode 4(雪豹)。

I found some lib can work on both ARC and non ARC project without adding any special setting. 我发现一些lib可以在ARC和非ARC项目上运行,而无需添加任何特殊设置。 I'm still waiting for the answer how to do this. 我仍在等待答案。 Write code using pure C? 使用纯C编写代码?

_objc_retainAutoreleasedReturnValue is a function of iOS 5.x's version of arc. _objc_retainAutoreleasedReturnValue是iOS 5.x版本的arc的功能。 You are attempting to build this framework and run it on iOS 4.3, which requires you to specify and deploy it for iOS 4.x, which runs the "ArcLite" framework. 您试图构建此框架并在iOS 4.3上运行它,这要求您为运行“ ArcLite”框架的iOS 4.x指定并部署它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 dyld:懒惰的符号绑定失败:找不到符号:_objc_setProperty_atomic - dyld: lazy symbol binding failed: Symbol not found: _objc_setProperty_atomic objc_autoreleaseReturnValue和objc_retainAutoreleasedReturnValue如何工作? - How do objc_autoreleaseReturnValue and objc_retainAutoreleasedReturnValue work? 找不到符号:启用ARC的dylib中的_objc_retainAutoreleaseReturnValue - Symbol not found: _objc_retainAutoreleaseReturnValue in ARC-enabled dylib 如何导入objc_retainAutoreleasedReturnValue? - How to import objc_retainAutoreleasedReturnValue? dyld:找不到符号:_OBJC_CLASS _ $ _ NSTextTab - dyld: Symbol not found: _OBJC_CLASS_$_NSTextTab 同时使用同一项目的ARC和非ARC版本会得到重复的符号错误 - Use both ARC and non-ARC versions from the same project get duplicated symbol error Mac OS X 10.4.11上的JNI错误…dyld:找不到符号:_objc_setProperty - JNI error on Mac OS X 10.4.11… dyld: Symbol not found: _objc_setProperty dyld:找不到符号:_OBJC_CLASS_$_Reachability,Xcode 11 崩溃 - dyld: Symbol not found: _OBJC_CLASS_$_Reachability, Xcode 11 crash Obj-C,dyld:找不到符号:_OBJC_CLASS _ $ _ NSUbiquitousKeyValueStore - Obj-C, dyld: Symbol not found: _OBJC_CLASS_$_NSUbiquitousKeyValueStore 具有非ARC静态库的启用ARC的项目 - ARC enabled project with a non-ARC static library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM