使用静态库导入自定义超类

时间:2013-11-28 12:21:51

标签: ios objective-c inheritance import static-libraries

我有一个静态库,我在许多不同的项目中使用它,并且最近在重构它以分裂两个子类中的类时遇到链接器错误。

错误是:

  "_OBJC_CLASS_$_APIServiceManager", referenced from:


      objc-class-ref in libAPIServices.a(APIAuthenicationService.o)


      _OBJC_CLASS_$_APIHTTPRequestServiceManager in libAPIServices.a(APIHTTPRequestServiceManager.o)


      objc-class-ref in libAPIServices.a(APIService.o)


      _OBJC_CLASS_$_APIJSONRequestServiceManager in libAPIServices.a(APIJSONRequestServiceManager.o)


      objc-class-ref in libAPIServices.a(APIJSONRequestServiceManager.o)


  "_OBJC_METACLASS_$_APIServiceManager", referenced from:


      _OBJC_METACLASS_$_APIHTTPRequestServiceManager in libAPIServices.a(APIHTTPRequestServiceManager.o)


      _OBJC_METACLASS_$_APIJSONRequestServiceManager in libAPIServices.a(APIJSONRequestServiceManager.o)


ld: symbol(s) not found for architecture i386


clang: error: linker command failed with exit code 1 (use -v to see invocation)

其中 APIServiceManager APIHTTPRequestServiceManager APIJSONRequestServiceManager 作为子类的超类。

在子类中,我使用:

导入super
#import "APIServiceManager.h"

2 个答案:

答案 0 :(得分:0)

点击 Xcode(左上角)中的项目名称以打开项目设置,而不是选择项目目标,而不是在主菜单中选择构建阶段和构建阶段选项转到链接二进制文件库并在此处添加所有静态库框架。

看屏幕截图.. see screen shot

答案 1 :(得分:0)

我最终到达那里,结果发现我没有在图书馆项目的“编译源”部分中包含超类