在iOS4.3中调试时使用了-fobjc_arc link参数,但是迁移到iOS5之后将其去掉后并不影响在iOS5中的运行和调试。但是一旦返回iOS4.3中则出现如下错误信息 dyld: Symbol notfound: _objc_retain Referenced from:/Users/ben/Library/Application Support/iPhoneSimulator/4.3.2/Applications/75915A97-7C3D-489A-B7B0-7B6895A4B584/ItsGoingUp.app/ItsGoingUp Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libobjc.A.dylib google的解答方法: Add -fobjc-arc in Build Settings =>Other Linker Flags (OTHER_LDFLAGS) for the different configurations You use it as a linker flag,not a compiler flag, so it doesn't affect ARC at compilation time, onlyat link time.
看来在iOS4.3的环境中如果使用了包含ARC特征的外部库,则必须加入此link标记,否则程序无法正常运行。
本文介绍了在从iOS5迁回iOS4.3时遇到的关于ARC的链接问题。在iOS4.3环境中,使用包含ARC的外部库需要在Other Linker Flags中添加-fobjc_arc,否则会出现dyld: Symbol not found: _objc_retain的错误。解决方案是在Build Settings的Other Linker Flags中为不同配置添加该标志,作为链接标志而非编译标志,确保程序在链接时能够正确处理ARC相关指令。
664

被折叠的 条评论
为什么被折叠?



