您好,欢迎来到伴沃教育。
搜索
您的当前位置:首页[UIViewController ttAddNavigatorController:]: unrecognized selector 的错误问题

[UIViewController ttAddNavigatorController:]: unrecognized selector 的错误问题

来源:伴沃教育

今天在工程里集成了Three20,一切都很顺利,运行时却抱[UIViewController ttAddNavigatorController:]: unrecognized selector异常。

经过查找资料:

http://developer.apple.com/library/mac/#qa/qa1490/_index.html

======================

A: Why do I get a runtime exception of "selector not recognized" when linking against an Objective-C static library that contains categories?

The "selector not recognized" runtime exception occurs due to an issue between the implementation of standard UNIX static libraries, the linker and the dynamic nature of Objective-C. Objective-C does not define linker symbols for each function (or method, in Objective-C) - instead, linker symbols are only generated for each class. If you extend a pre-existing class with categories, the linker does not know to associate the object code of the core class implementation and the category implementation. This prevents objects created in the resulting application from responding to a selector that is defined in the category.

To resolve this issue, the target linking against the static library must pass the -ObjC option to the linker. This flag causes the linker to load every object file in the library that defines an Objective-C class or category. While this option will typically result in a larger executable (due to additional object code loaded into the application), it will allow the successful creation of effective Objective-C static libraries that contain categories on existing classes. Follow these steps to pass -ObjC to the linker:

在工程设置里加上 -ObjC 后, 问题搞定

转载于:https://www.cnblogs.com/marrco2005/archive/2012/01/10/marrco2005_1.html

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务