[英]initialization from incompatible pointer type
-(void)initializeTableData
{
sqlite3 *db=[DatabaseTestAppDelegate getNewDBConnection];
sqlite3_stmt *statement=nil;
const char *sql="select * from WhereTo";
if (sqlite3_prepare_v2(db, sql, -1, &statement, NULL)!=SQLITE_OK)
NSAssert1(0,@"error in preparing staement",sqlite3_errmsg(db));
else {
while(sqlite3_step(statement)==SQLITE_ROW)
[tableData addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement,1)]];
}
sqlite3_finalize(statement);
}
at sqlite3 *db=[DatabaseTestAppDelegate getNewDBConnection];
在sqlite3 *db=[DatabaseTestAppDelegate getNewDBConnection];
<--- it says, DatabaseTestAppDelegate may not respond to '+getNewDbConnection' <--- 它说,DatabaseTestAppDelegate 可能不会响应 '+getNewDbConnection'
and here is my getNewDbConnection这是我的 getNewDbConnection
+(sqlite3 *) getNewDBConnection{
sqlite3 *newDBconnection;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Malacca-lah.sqlite"];
// Open the database. The database was prepared outside the application.
if (sqlite3_open([path UTF8String], &newDBconnection) == SQLITE_OK) {
NSLog(@"Database Successfully Opened :)");
}
else {
NSLog(@"Error in opening database :(");
}
return newDBconnection;
}
im new to XCode and also SQLite... been learning this for the past few weeks now, trying to get a hang on it... anyways, pls help me out with this problem.我是 XCode 和 SQLite 的新手......过去几周一直在学习这个,试图抓住它......无论如何,请帮助我解决这个问题。 I understand the whole code but i dont understand why the inheritance has an issue.我了解整个代码,但我不明白为什么 inheritance 有问题。
Thanks in advance提前致谢
If it says that a class may not respond to a selector, it means that it can not able to find the method declaration of the selector.如果它说一个 class 可能没有响应选择器,这意味着它无法找到选择器的方法声明。 Have you declared the method +(sqlite3 *)getNewDBConnection
in DatabaseTestAppDelegate
's header( ".h"
) file?您是否在DatabaseTestAppDelegate
的标头( ".h"
)文件中声明了方法+(sqlite3 *)getNewDBConnection
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.