这条消息有什么问题?

时间:2011-05-04 14:15:29

标签: objective-c

以下是信息:

[SQLiteDB addRecordToDatabase:(ZBarSymbol *)symbol];  //  add this record to the d/b

以下是.h文件中消息的定义:

- (void)addRecordToDatabase:(ZBarSymbol *)symbol ;

以下是消息的实现:

//---------------------    addRecordToDatabase    ----------------------|
- (void)addRecordToDatabase: (ZBarSymbol *)symbol  {

执行期间出现以下错误:

2011-05-04 07:07:32.518 PointPeek[208:707] +[SQLiteDB addRecordToDatabase:]: unrecognized selector sent to class 0x276b8
2011-05-04 07:07:32.574 PointPeek[208:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SQLiteDB addRecordToDatabase:]: unrecognized selector sent to class 0x276b8'

它出了什么问题?

1 个答案:

答案 0 :(得分:3)

它被声明为实例方法并用作类方法。类方法用“+”符号声明。

+ (void)addRecordToDatabase:(ZBarSymbol *)symbol;

This question讨论了实例与类的方法。