0
我在閱讀說明時遇到了錯誤。有些事情一定出錯了,但我不太確定我該如何解決它。這是我的代碼,實際上我並不清楚這個代碼中究竟發生了什麼。將記錄載入detailview
- (void) hydrateDetailViewData {
//if detail view is hydrated then do not get it from database
if(isDetailViewHydrated) return;
if(detailStmt == nil) {
const char *sql = "select snapTitle, snapDesc from Snap where snapID =?";
if(sqlite3_prepare_v2(database, sql, -1, &detailStmt, NULL) != SQLITE_OK)
NSAssert1(0, @"Error while creating detail view statement. '%s'", sqlite3_errmsg(database));
NSLog(@"SQLite= %d", sqlite3_step(detailStmt));
}
if(SQLITE_DONE != sqlite3_step(detailStmt)) {
// NSString *descStr = [[NSString alloc]
//initWithString:sqlite3_column_text(detailStmt, 2)];
NSString *descStr = [NSString stringWithUTF8String:(char *)sqlite3_column_text(detailStmt,2)];
self.snapDescription = descStr;
[descStr release];
}
else
NSAssert1(0, @"Error getting description of snap2play. '%s'", sqlite3_errmsg(database));
sqlite3_reset(detailStmt);
isDetailViewHydrated = YES; //if hydrated, make sure do not get from database again.
}
}
Error message: 2010-03-12 16:17:14.377 Snap2Play[51282:20b] SQLite= 101 2010-03-12 16:17:14.378 Snap2Play[51282:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString'
???
不起作用... – summer 2010-03-12 08:44:51