Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IOS 7,韩元';t写入sqlite数据库_Sqlite_Ios7 - Fatal编程技术网

IOS 7,韩元';t写入sqlite数据库

IOS 7,韩元';t写入sqlite数据库,sqlite,ios7,Sqlite,Ios7,我正在开发一个iOS应用程序,自从迁移到Xcode 5和IOS7后,我遇到了一些问题。 在ios7设备上测试时,我无法写入数据库。 在模拟器工作良好(iOS 7)。在iOS 6设备上工作正常 这是我写进sqlite3数据库的代码。 之后,我从同一个数据库中读取数据,但值没有改变。 在多个设备上测试 提前谢谢 sqlite3 *db9; @try { NSFileManager *fileMgr9 = [NSFileManager defaultManager];

我正在开发一个iOS应用程序,自从迁移到Xcode 5和IOS7后,我遇到了一些问题。 在ios7设备上测试时,我无法写入数据库。 在模拟器工作良好(iOS 7)。在iOS 6设备上工作正常

这是我写进sqlite3数据库的代码。 之后,我从同一个数据库中读取数据,但值没有改变。 在多个设备上测试

提前谢谢

 sqlite3 *db9;
    @try {
        NSFileManager *fileMgr9 = [NSFileManager defaultManager];
        NSString *dbPath9 = [[[NSBundle mainBundle]resourcePath]stringByAppendingPathComponent:@"db.sqlite3"];
        BOOL success9 = [fileMgr9 fileExistsAtPath:dbPath9];
        if (!success9) {
            NSLog(@"Cannot locate database file '%@'.", dbPath9);
        }

        else NSLog(@"Database file located at: '%@'.", dbPath9);
        if (!(sqlite3_open([dbPath9 UTF8String], &db9) == SQLITE_OK)) {
            NSLog(@"An error has occured");
        }


        NSString *strSQL9 = [NSString stringWithFormat:@"UPDATE teste SET scor = ?, timp = ? WHERE id = ?"];


        const char *sql9 = [strSQL9 UTF8String];


        sqlite3_stmt *sqlStatement9;
        if (sqlite3_prepare(db9, sql9, -1, &sqlStatement9, NULL) != SQLITE_OK) {
            NSLog(@"Problem with prepare statement");
        }else

        {
            NSLog(@"middle of it - scrie");

            if (scordb1 == 0) {
                sqlite3_bind_int(sqlStatement9, 1, scorTestTotal);
            }else
                sqlite3_bind_int(sqlStatement9, 1, ((scorTestTotal+scordb1)/2));


            sqlite3_bind_int(sqlStatement9, 2, timeInterval);
            sqlite3_bind_int(sqlStatement9, 3, vasile);

            sqlite3_step(sqlStatement9);
            int success = sqlite3_step(sqlStatement9);
            sqlite3_reset(sqlStatement9);

            if (success == SQLITE_ERROR){ NSLog(@"error write");}
            else {NSLog(@"success write");}



        }


        sqlite3_finalize(sqlStatement9);
        sqlite3_close(db9);
        NSLog(@"Close db SCRIE db9");

    }
    @catch (NSException *exception) {
        NSLog(@"An exception occured: %@", [exception reason]);

    }

这个可能的重复解决了我的问题。谢谢