Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QT on iOS8 with Xcode 6 cannot save files [solved]
Forum Updated to NodeBB v4.3 + New Features

QT on iOS8 with Xcode 6 cannot save files [solved]

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • elliott0124E Offline
    elliott0124E Offline
    elliott0124
    wrote on last edited by
    #1

    Hi guys..

    I update QT5.3.2 with Xcode 6 on Macbook, and run my apps on iPad with iOS8.

    I cannot save files on iPad.
    Before this update, I'm using QT5.3.1 with Xcode 5.1, and run my app on iPad with iOS7 is just fine.

    Saving file directory is "../Documents/myFiles.db"

    Would someone give me a hand. Thanks.

    1 Reply Last reply
    0
    • E Offline
      E Offline
      eduneb
      wrote on last edited by
      #2

      Hi

      the problems is that the directory is somewhere else

      use this to find out and should work in any devices

      @QString homeLocation = QStandardPaths::locate(QStandardPaths::DocumentsLocation, QString(), QStandardPaths::LocateDirectory);
      QString filename=homeLocation+"acc.txt";
      tf.setFileName(filename);
      tf.open(QIODevice::ReadWrite);
      @

      cheers
      ed

      1 Reply Last reply
      0
      • elliott0124E Offline
        elliott0124E Offline
        elliott0124
        wrote on last edited by
        #3

        Hi, Eduneb

        Thank you for very fast help.

        I fellow your example, it's really work.

        But in my case, using SQLite function for create db file, it's not work.

        Post my simple code above, this simple work fine in the older version of Xcode.

        QSqlDatabase thisDB;
        
        QString homeLocation = QStandardPaths::locate(QStandardPaths::DocumentsLocation, QString(), QStandardPaths::LocateDirectory);
        QString dbName=homeLocation+"SYSTEM.DB3";
        thisDB.close();
        thisDB = QSqlDatabase::addDatabase("QSQLITE",dbName);
        if (thisDB.open() == true) {
            return thisDB.isValid();
        }
        qDebug() << "lastError:" << thisDB.lastError();
        

        It can't create dbName file (SQLite spec).

        1 Reply Last reply
        0
        • elliott0124E Offline
          elliott0124E Offline
          elliott0124
          wrote on last edited by
          #4

          Sorry everyone, I have solved this problem.

          I change my code:

          Before:
          thisDB = QSqlDatabase::addDatabase(“QSQLITE”,dbName);

          After:
          thisDB = QSqlDatabase::addDatabase("QSQLITE");
          thisDB.setDatabaseName(dbName);

          It just work by now. Thank you.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved