私が試したコードを投稿しています。文字列値を取得していますが、nsstringのすべての値をnsmutablearrayに追加して印刷すると、null値が取得されます。
//ViewController.h
@interface ViewController : UIViewController{
NSString *stringValueVideoiD;
NSMutableArray *TableVideoIDArray;
}
//ViewController.m
@implementation ViewController
- (void)viewDidLoad
{
TableVideoIDArray=[[NSMutableArray alloc]init];
}
-(void) getAllRows{
if(sqlite3_open([databasePath UTF8String], &db) == SQLITE_OK)
{
NSString *sqlStatement = [NSString stringWithFormat:@"SELECT * FROM table"];
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(db,[sqlStatement UTF8String] , -1, &compiledStatement, NULL)== SQLITE_OK)
{
while(sqlite3_step(compiledStatement)==SQLITE_ROW)
{
char *videoId = (char *) sqlite3_column_text(compiledStatement, 1);
stringValueVideoiD = [[NSString alloc] initWithUTF8String:videoId];
[TableVideoIDArray addObject:stringValueVideoiD];
NSLog(@"vids id:%@",TableVideoIDArray);
//vids id:(null) is printed
}
}
}
}