[英]'+[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil' (Cocos2D)
[英]Function with argument to a NSInvocation method
我有谁正在使用那些2函数的控制器视图:
[appDelegate getFichesInfo:[[self.fichesCategory idModuleFiche] intValue] ]; //first function
self.fiche = (Fiche *)[appDelegate.fichesInfo objectAtIndex:0];
[appDelegate getFichesVisuels:[[self.fiche idFiche] intValue] ]; //second function not working
self.fiche = (Fiche *)[appDelegate.fichesInfo objectAtIndex:0];
因此,在我的ressourceManager中,下面是第二个函数的详细信息:
- (void)getFichesVisuels:(int)value {
fichesVisuels = [[NSMutableArray alloc] init];
sqlite3 *database;
if(sqlite3_open([self.databasePath UTF8String], &database) == SQLITE_OK) {
sqlite3_reset(getFichesVisuelsStatement);
sqlite3_bind_int(getFichesVisuelsStatement, 1, value);
while(sqlite3_step(getFichesVisuelsStatement) == SQLITE_ROW) {
NSString *aTitle = [NSString stringWithUTF8String:(char *)sqlite3_column_text(getFichesVisuelsStatement , 7)];
NSString *aLpath = [NSString stringWithUTF8String:(char *)sqlite3_column_text(getFichesVisuelsStatement , 8)];
Visuel *visuel = [[Visuel alloc] initWithName:aTitle lpath:aLpath];
[fichesVisuels addObject:visuel];
}
}
sqlite3_close(database);
}
问题在于第二个函数无法正常工作(库例程按顺序调用),因为我已经以相同的方式调用了第一个函数(我想能够同时使用参数执行许多查询)。 我听说使用NSInvocation可以解决此问题,但是我不知道如何使用NSInvocation转换代码。 有人可以帮我吗?
最好的祝福,
您可能遇到的问题是,在sqlite3_close
之后,您准备的语句无效。 每次打开数据库时,都需要创建一个新的准备好的语句。
sqlite3_open
打开数据库。 sqlite3_prepare
和朋友准备语句。 sqlite3_bind
绑定。 sqlite3_step
。 sqlite3_finalize
。 sqlite3_close
关闭数据库。 您不能只重置该语句,因为该语句是为其他数据库句柄准备的。
我对SQLite不太熟悉。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.