链接静态库时发送到实例的无法识别的选择器?

时间:2012-07-04 04:23:51

标签: iphone ios5 static-libraries xcode4.3

我是这个iPhone开发的新手。现在我正在尝试开发一个静态库。我成功地创建了库。但是当我试图访问一个函数显示错误时,我遇到了问题 “无法识别的选择器被发送到实例”。当我搜索他们中的大多数时,他们告诉将-objc放入其他链接器标志和forceaall以及所有加载。但没有任何效果。

我已经推荐这个网站来开发这个库。 http://www.icodeblog.com/2011/04/07/creating-static-libraries-for-ios/

1 个答案:

答案 0 :(得分:0)

导致错误消息的常见原因是当您调用未在接口类(.h)中声明或根本不存在的方法时。

@interface YourClass
//other programmers forget to declare method in header
-(void)declaredMethod;
@end


@implementation YourClass
 -(void)declaredMethod
   { 
     //this is fine
   }
 -(void)undeclaredMethod
   {
    // declaration in header is missing
    // will throw exception
   }
@end