常见的一个错误
在调用:
BlogDB *blogDB = [[BlogDB alloc] init];
[blogDB saveBlog:self];
[blogDB findWithBlogid:@"1" limit:20];
[blogDB release];
出现
2013-05-06 17:59:17.105 LRDemo[44313:c07] -[BlogDB findWithBlogid:limit:]: unrecognized selector sent to instance 0x81de740
2013-05-06 17:59:17.106 LRDemo[44313:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[BlogDB findWithBlogid:limit:]: unrecognized selector sent to instance 0x81de740'
*** First throw call stack:
(0x1f8b052 0x195ad0a 0x1f8cced 0x1ef1f00 0x1ef1ce2 0x3455f 0x7f6a2 0x7f765 0x7f7e0 0x80342 0x1f8ce72 0x4ecab 0x1f8ce72 0x16289ef 0x1f5f97f 0x1ec2b73 0x1ec2454 0x1ec1db4 0x1ec1ccb 0x2238879 0x223893e 0xd10a9b 0x2fd69 0x2485)
terminate called throwing an exception(lldb)
解决方案:
- (NSArray *) findWithBlogid:(NSString *) blogid limit:(int) limit{}
在 .h 头文件中没有 声明 - (NSArray *) findWithBlogid:(NSString *) blogid limit:(int) limit;
声明了 之后就可以了