ios13 sqlite attempt to write a readonly database



  • I have copied a database from qml.qrc to /Documents/databases, like this:

            QString dir;
            QDir current_dir;
    
            
            dir = QDir::homePath()+"/Documents/databases";
            if(current_dir.exists(dir) == false){
                current_dir.mkpath(dir);
                QFile::copy(":/MyDataBase.db", QDir::homePath()+"/Documents/databases/MyDataBase.db");
            }
    

    And when I update the table, it said that

    QSqlError("8", "Unable to fetch row", "attempt to write a readonly database")
    

    What could I do for that?



  • I found that I must set permission after copy it


Log in to reply