我无法将值加载到数组中

时间:2011-02-07 19:42:11

标签: iphone objective-c

    const char *dbpath = [databasePath UTF8String];
UserArray = [[NSMutableArray alloc]init];

sqlite3_stmt *compiledStatement;
if(sqlite3_open(dbpath, &db) == SQLITE_OK)
{

    NSString *querySQL = [NSString stringWithFormat: @"select UserName,FullName,Email from User" ];
    const char *sqlStatement =[querySQL UTF8String];
    if(sqlite3_prepare_v2(db ,sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK)
    {
        while(sqlite3_step(compiledStatement) == SQLITE_ROW ) 
        {
            NSString *aUserName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)];
            NSString *aFullName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
            NSString *aEmail = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];


            // Create a new animal object with the data from the database
            User *obj_user = [[User alloc] initWithUserName:aUserName FullName:aFullName Email:aEmail];

            // Add the animal object to the animals Array
            [UserArray addObject:obj_user];

            [User release];
        }
    }

    // Release the compiled statement from memory
    sqlite3_finalize(compiledStatement);
}

sqlite3_close(db);

}

嘿所有,

I am trying to put value into array of object but it throw's error Like Below...
anyone guide me why i got this type of error.

由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [UICachedDeviceRGBColor UserArray]:无法识别的选择器发送到实例0x6a396f0'

0 个答案:

没有答案