Important: Please read the Qt Code of Conduct -

[solved] iOS - Qt4iOS - mobility (problem of mine)

  • To begin with i will start by congratulating Qt4iOS for the latest update!

    The problem that i am having which unfortunately i can't solve it on my own is the following:

    I am using the latest version of Qt4iOS with the iOS plugin, using XCode 4.5 and targeting a iPod Touch (4th generation) with software version 6.0

    I am porting an application which makes use of the sensors of the phone. Till now i am able to compile successfully the application, deploy and run it. But when i try to start any sensor, it just fails to do it returning false from the start function of any sensor.

    Apart from that i have updated the "Required device capabilities" in the .plist to include the accelerometer etc. but still now luck.

    And a second question, is the QDesktopServices::openUrl able to open and show an image that is locally stored lets say at the /Documents folder of the application? Opening a http Url works fine but any call to file:// content fails.

    Any idea?

    Thank you very much in advance!

  • As iOS applications need to be linked statically, you will need to statically link any plugins to your application as well as the Qt libraries.

    In order to instantiate the 'sensors' plugin you'll need to put the following in your application's source code:

    #if defined( Q_OS_IOS )
    #include <QtPlugin>

  • The QDesktopServices::openUrl() method uses iOS system calls to open a document. As whichever application (Safari, Preview etc.) needs to have access to the part of the file system a local file is stored in, it won't be able to open files in your application's 'sandbox'. You will need to store the file in a 'public' folder (like /private/var/mobile/media), although Apple is unlikely to approve an application that writes files outside of its 'sandbox'.

  • Thank you very much for your help!

    Everything works quite fine now :)

Log in to reply