【发布时间】:2011-04-09 12:14:09
【问题描述】:
我想向 UIImage 添加一个类别并将其链接到我的 iPhone 应用程序,但出现此错误:
(无法识别的选择器)
我的代码:DoingStuff.h
#import <UIKit/UIKit.h>
@interface UIImage (DoingStuff)
- (UIImage *)performStuff;
@end
DoingStuff.m
#import "DoingStuff.h"
@implementation UIImage (DoingStuff)
- (UIImage *)performStuff
{
// My code here
}
@end
但是当我运行我的程序时,我得到了这个:
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[UIImageView performStuff:]: unrecognized selector sent to instance 0x4b415d0”
【问题讨论】:
-
“链接”是什么意思?类别是否放在静态库中?
-
不,我只想在我的程序中使用新类别在 UIImage 上做一些事情。
-
你看过我的回答了吗?似乎您只是没有在调用类中添加
import语句。
标签: iphone linker uiimageview uiimage categories