I have a problem in objective-c. I am triying to create a common database access in my app by handling the opening, consult and closing of the database in one class, and then processing the sqlite3_stmt variable in another class, but when I try to return the sqlite3_stmt variable I get the error "incompatible types in return". (and they are both sqlite3_stmt, i have checked.) here is the code, as simplified as I can. Any help would be greatly appreciated:
HEADER:
@interface statement : NSObject
{
sqlite3_stmt *consulta;
}
-(void)setConsulta:(sqlite3_stmt *)c;
-(sqlite3_stmt)getConsulta;
@end
BODY
import "statement.h"
@implementation statement
//@synthesize consulta;
-(void)setConsulta:(sqlite3_stmt *)c
{
self.consulta=c;
}
-(sqlite3_stmt)getConsulta
{
return consulta;
}
@end
开发者_StackOverflow社区
In "-(sqlite3_stmt)getConsulta" you're missing a *. It should be
-(sqlite3_stmt *)getConsulta { .... }
Don't forget to fix it in the @implementation as well.
精彩评论