Important: Please read the Qt Code of Conduct -

iOS app crashing... only in non-debug mode

  • My iOS app works fine when I launch it in debug mode and if I disconnect the USB cable, it continues to work fine. If I let the iPad sit idle for a while then I attempt to start the app, it will either crash immediately or sometimes it will run for a bit until I try to interact with it and then it will crash.

    If I build it for release, then it crashes as soon as I interact with it. In the debug stream, it says "program received signal -111, thread:49c3f" followed by a bunch of hex codes. Then it says "hit maximum number of consecutive signals, stopping".

    I find it odd that I'm getting debug messages in release mode... Is it supposed to do that?

    Anyway, I'm not sure how to debug this. Any ideas?

  • Lifetime Qt Champion


    One thing would be to first check if you have any un-initialiased variable. Then since you can make it crash after some idle time then you should try to get a backtrace. Don't disconnect the device.

    You should also add some information:

    • What version of Qt are you using ?
    • What version of iOS ?
    • What version of Xcode ?
    • What version of macOS ?

  • When you say initialised, do you mean like this?

    class myclass: public QObject
        //other functions
        int m_var1;
        int m_var2;
        //other variables
        m_var1(0), m_var2(0)   // <---- initialization?
       //some init code

    I saw that in the example code I used as a starter but didn't really understand the point of it. For all of the member variables I created, I initialized them in the traditional c++ way within the body of the constructor (the "//some init code" part).

    I'm using QT 5.9.2 and I think all of my other software is up-to-date with the latest release version.

  • Qt Champions 2019

    @kgregory The traditional way to initialise member variables in C++ is actually not in the body of the constructor, but like in your example:

        m_var1(0), m_var2(0)

  • Hmm, I guess I was taught wrong.

    What does the initialization look like if I have an array. For example, I initialize this array of 6 QColors in my object.

        //myclass declaration
        QColor colors[6];
        //myclass object constructor body
        colors[0] = QColor(255,0,0);
        colors[1] = QColor(255,255,0);
        colors[2] = QColor(0,255,0);
        colors[3] = QColor(0,255,255);
        colors[4] = QColor(0,0,255);
        colors[5] = QColor(255,0,255);

    And what if the variable is another class like QDeviceDiscoveryAgent?

  • Lifetime Qt Champion

    Such complex initialisation goes in the body of the constructor.

    As for a pointer to a object: in the list.

        m_myAgent(new QDeviceDiscoverAgent)


        m_myAgent(new QDeviceDiscoverAgent(this))

    if you want to pass it one or more parameters.

Log in to reply