[英]'+[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.