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. iOS app crashing... only in non-debug mode
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 3 Posters 1.4k 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.
  • K Offline
    K Offline
    kgregory
    wrote on 21 Nov 2017, 03:46 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 21 Nov 2017, 10:12 last edited by
      #2

      Hi,

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kgregory
        wrote on 22 Nov 2017, 03:15 last edited by kgregory
        #3

        When you say initialised, do you mean like this?

        //myclass.h
        class myclass: public QObject
        {
        public:
            myclass();
            ~myclass();
            //other functions
        
        private:
            int m_var1;
            int m_var2;
            //other variables
        };
        
        //myclass.cpp
        myclass::myclass():
            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.

        J 1 Reply Last reply 22 Nov 2017, 05:43
        0
        • K kgregory
          22 Nov 2017, 03:15

          When you say initialised, do you mean like this?

          //myclass.h
          class myclass: public QObject
          {
          public:
              myclass();
              ~myclass();
              //other functions
          
          private:
              int m_var1;
              int m_var2;
              //other variables
          };
          
          //myclass.cpp
          myclass::myclass():
              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.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 22 Nov 2017, 05:43 last edited by
          #4

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

          myclass::myclass():
              m_var1(0), m_var2(0)
          {}
          

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • K Offline
            K Offline
            kgregory
            wrote on 22 Nov 2017, 20:17 last edited by
            #5

            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?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 22 Nov 2017, 20:21 last edited by
              #6

              Such complex initialisation goes in the body of the constructor.

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

              myclass::myclass():
                  m_myAgent(new QDeviceDiscoverAgent)
              {}
              

              or

              myclass::myclass():
                  m_myAgent(new QDeviceDiscoverAgent(this))
              {}
              

              if you want to pass it one or more parameters.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              6/6

              22 Nov 2017, 20:21

              • Login

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