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. Inherited QGuiApplication object do not working on iOS Simulator. Why?
Forum Updated to NodeBB v4.3 + New Features

Inherited QGuiApplication object do not working on iOS Simulator. Why?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
21 Posts 4 Posters 3.0k Views 2 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.
  • B Offline
    B Offline
    bogong
    wrote on last edited by bogong
    #1

    Hello all!
    Just got strange thing. The very simple class inherited from QGuiApplication do not working on iOS Simulator only. When I run it on Simulator it's starting and closing. Without any error message. When on iOS device everything fine. The same for desktop and Android - everything OK. The message that I see in iOS Simulator:

    18:06:47: Starting remote process.
    QML debugging is enabled. Only use this in a safe environment.
    18:06:49: Run ended.
    

    Nothing more than it.

    The class is very simple:

    • class CustomGuiApplication.cpp
    CustomGuiApplication::CustomGuiApplication(int inCounter,char *inArguments[]) : QGuiApplication(inCounter,inArguments) {}
    
    CustomGuiApplication::~CustomGuiApplication(void) {}
    
    • header CustomGuiApplication.h
    CustomGuiApplication : public QGuiApplication {
    
    	public:
    
    		explicit CustomGuiApplication(int inCounter,char *inArguments[]);
    		virtual ~CustomGuiApplication(void);
    };
    

    When I am using pure QGuiApplication all is OK. It's happening only if I am inheriting class and only on Simulator.
    Is it bug???

    jsulmJ kshegunovK 2 Replies Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Without knowing what you are doing in your custom class it's impossible to answer.

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

      B 1 Reply Last reply
      -1
      • B bogong

        Hello all!
        Just got strange thing. The very simple class inherited from QGuiApplication do not working on iOS Simulator only. When I run it on Simulator it's starting and closing. Without any error message. When on iOS device everything fine. The same for desktop and Android - everything OK. The message that I see in iOS Simulator:

        18:06:47: Starting remote process.
        QML debugging is enabled. Only use this in a safe environment.
        18:06:49: Run ended.
        

        Nothing more than it.

        The class is very simple:

        • class CustomGuiApplication.cpp
        CustomGuiApplication::CustomGuiApplication(int inCounter,char *inArguments[]) : QGuiApplication(inCounter,inArguments) {}
        
        CustomGuiApplication::~CustomGuiApplication(void) {}
        
        • header CustomGuiApplication.h
        CustomGuiApplication : public QGuiApplication {
        
        	public:
        
        		explicit CustomGuiApplication(int inCounter,char *inArguments[]);
        		virtual ~CustomGuiApplication(void);
        };
        

        When I am using pure QGuiApplication all is OK. It's happening only if I am inheriting class and only on Simulator.
        Is it bug???

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @bogong Did you try to debug on simulator? Stack trace could provide more information about what is happening.

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

        B 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Without knowing what you are doing in your custom class it's impossible to answer.

          B Offline
          B Offline
          bogong
          wrote on last edited by bogong
          #4

          @SGaist that whole class is in previous message.

          B 1 Reply Last reply
          0
          • jsulmJ jsulm

            @bogong Did you try to debug on simulator? Stack trace could provide more information about what is happening.

            B Offline
            B Offline
            bogong
            wrote on last edited by bogong
            #5

            @jsulm No any errors in debug mode. In debug mode just freeze on system launch-screen. Only this:
            Screenshot 2019-10-02 at 13.35.48.png

            In following objects map. It's creating but not working properly.
            Screenshot 2019-10-02 at 13.59.54.png

            1 Reply Last reply
            0
            • B bogong

              @SGaist that whole class is in previous message.

              B Offline
              B Offline
              bogong
              wrote on last edited by
              #6

              @jsulm And this what I see on real device for the same project, everything works fine:

              Screenshot 2019-10-02 at 13.40.00.png

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bogong
                wrote on last edited by
                #7

                And there was no any troubles on 5.12.4 version. I am doing what I've been doing always - inheriting QGuiApplication for future defining event filter. Nothing more. It's working everywhere but not in iOS Simulator.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  bogong
                  wrote on last edited by bogong
                  #8

                  Just tested on other MacOS workstation. Everything works fine for all platforms. The troubles with simulator on one computer. Might be after downgraded XCode after update.

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    bogong
                    wrote on last edited by bogong
                    #9

                    I've been wrong in previous message. Just reinstalled on Qt 5.12.5 and Xcode 10.3 from scratch on clean and totally erased MacBook. The same result it's not working only on iOS Simulator. When I ran it in XCode directly - got this error:

                    Screenshot 2019-10-03 at 01.16.52.png
                    Screenshot 2019-10-03 at 01.17.27.png

                    Why it might be only in iOS simulator? Every other platform working perfectly.

                    1 Reply Last reply
                    0
                    • B bogong

                      Hello all!
                      Just got strange thing. The very simple class inherited from QGuiApplication do not working on iOS Simulator only. When I run it on Simulator it's starting and closing. Without any error message. When on iOS device everything fine. The same for desktop and Android - everything OK. The message that I see in iOS Simulator:

                      18:06:47: Starting remote process.
                      QML debugging is enabled. Only use this in a safe environment.
                      18:06:49: Run ended.
                      

                      Nothing more than it.

                      The class is very simple:

                      • class CustomGuiApplication.cpp
                      CustomGuiApplication::CustomGuiApplication(int inCounter,char *inArguments[]) : QGuiApplication(inCounter,inArguments) {}
                      
                      CustomGuiApplication::~CustomGuiApplication(void) {}
                      
                      • header CustomGuiApplication.h
                      CustomGuiApplication : public QGuiApplication {
                      
                      	public:
                      
                      		explicit CustomGuiApplication(int inCounter,char *inArguments[]);
                      		virtual ~CustomGuiApplication(void);
                      };
                      

                      When I am using pure QGuiApplication all is OK. It's happening only if I am inheriting class and only on Simulator.
                      Is it bug???

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by
                      #10

                      @bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:

                      CustomGuiApplication::CustomGuiApplication(int inCounter,char *inArguments[])
                          : QGuiApplication(inCounter, inArguments)
                      {
                      }
                      

                      is wrong. The argc must be passed by reference, not by value. Also a friendly piece of advice - don't inherit from QXXXApplication for no good reason at all ...

                      Read and abide by the Qt Code of Conduct

                      B 1 Reply Last reply
                      0
                      • kshegunovK kshegunov

                        @bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:

                        CustomGuiApplication::CustomGuiApplication(int inCounter,char *inArguments[])
                            : QGuiApplication(inCounter, inArguments)
                        {
                        }
                        

                        is wrong. The argc must be passed by reference, not by value. Also a friendly piece of advice - don't inherit from QXXXApplication for no good reason at all ...

                        B Offline
                        B Offline
                        bogong
                        wrote on last edited by bogong
                        #11

                        @kshegunov ??? But why it's working everywhere else but not in iOS Simulator only??? And why it's working on 5.12.4 but not in Qt 5.12.5 and 5.13.1??? Why do the error looks like architecture trouble but not application??? Why has it been working at least for 5 applications since 2014???

                        kshegunovK 1 Reply Last reply
                        0
                        • B bogong

                          @kshegunov ??? But why it's working everywhere else but not in iOS Simulator only??? And why it's working on 5.12.4 but not in Qt 5.12.5 and 5.13.1??? Why do the error looks like architecture trouble but not application??? Why has it been working at least for 5 applications since 2014???

                          kshegunovK Offline
                          kshegunovK Offline
                          kshegunov
                          Moderators
                          wrote on last edited by
                          #12

                          Are we arguing now?

                          But why it's working everywhere else but not in iOS Simulator only???

                          Even if it worked on every other platform beside X, then it's not working, exactly because it doesn't work on X. You can't have it both ways, it either works, or it doesn't. If it works then it works everywhere, if it's broke sometimes then it doesn't work.

                          Why do the error looks like architecture trouble but not application???

                          Oh, no, it's user-code error.
                          Compare signatures: https://doc.qt.io/qt-5/qcoreapplication.html#QCoreApplication

                          Read and abide by the Qt Code of Conduct

                          B 1 Reply Last reply
                          0
                          • kshegunovK kshegunov

                            Are we arguing now?

                            But why it's working everywhere else but not in iOS Simulator only???

                            Even if it worked on every other platform beside X, then it's not working, exactly because it doesn't work on X. You can't have it both ways, it either works, or it doesn't. If it works then it works everywhere, if it's broke sometimes then it doesn't work.

                            Why do the error looks like architecture trouble but not application???

                            Oh, no, it's user-code error.
                            Compare signatures: https://doc.qt.io/qt-5/qcoreapplication.html#QCoreApplication

                            B Offline
                            B Offline
                            bogong
                            wrote on last edited by bogong
                            #13

                            @kshegunov This *inArguments[] totally equal **inArguments ... It was BTW ... And it's working on Linux, Windows, MacOS and iOS device but not on iOS Simulator only ...

                            kshegunovK 1 Reply Last reply
                            0
                            • B bogong

                              @kshegunov This *inArguments[] totally equal **inArguments ... It was BTW ... And it's working on Linux, Windows, MacOS and iOS device but not on iOS Simulator only ...

                              kshegunovK Offline
                              kshegunovK Offline
                              kshegunov
                              Moderators
                              wrote on last edited by
                              #14

                              @bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:

                              This *inArguments[] totally equal **inArguments

                              Yes, the former decays to the latter, but as I said originally int & is very different from int.

                              Read and abide by the Qt Code of Conduct

                              B 1 Reply Last reply
                              1
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                One important thing, your constructor signature is wrong. See here, it's a reference to an int not an int for argc.

                                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
                                • kshegunovK kshegunov

                                  @bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:

                                  This *inArguments[] totally equal **inArguments

                                  Yes, the former decays to the latter, but as I said originally int & is very different from int.

                                  B Offline
                                  B Offline
                                  bogong
                                  wrote on last edited by bogong
                                  #16

                                  @kshegunov And how it explain that is not working on iOS Simulator only??? Is there special C++ syntax for iOS Simulator??? I mean if I am wrong - OK, but why it's crashing on iOS Simulator only but not everywhere?

                                  kshegunovK 1 Reply Last reply
                                  0
                                  • B bogong

                                    @kshegunov And how it explain that is not working on iOS Simulator only??? Is there special C++ syntax for iOS Simulator??? I mean if I am wrong - OK, but why it's crashing on iOS Simulator only but not everywhere?

                                    kshegunovK Offline
                                    kshegunovK Offline
                                    kshegunov
                                    Moderators
                                    wrote on last edited by kshegunov
                                    #17

                                    @bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:

                                    And how it explain that is not working on iOS Simulator only???

                                    You've been relying on an implementation detail (and possibly undefined behavior).
                                    Let me put this into an example:

                                    static SomeClass global1 = SomeClass(0);
                                    static OtherClass global2 = OtherClass(global1);
                                    
                                    int main(...)
                                    {
                                        ...
                                    }
                                    

                                    Seems legit, right? Well it's not, the moment global2 touches global1 you're in undefined behavior land. The order of (nontrivial) statics intialization is undefined. So even if it works on 100 different platforms, it's still broke, and when the 101st actually breaks it, you don't say - "well it worked 100 times, so there's something wrong with 101st", you say "damn, I had the rotten luck of it working 100 times before it showed its ugly fangs and horns".[1]

                                    Is there special C++ syntax for iOS Simulator???

                                    Of course not, but you've not satisfied the requirements put forward by the framework - that is you've passed a local copy instead of the original variable holding the number of arguments.

                                    [1]: https://en.wikipedia.org/wiki/Thirteenth_stroke_of_the_clock

                                    Read and abide by the Qt Code of Conduct

                                    B 1 Reply Last reply
                                    2
                                    • kshegunovK kshegunov

                                      @bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:

                                      And how it explain that is not working on iOS Simulator only???

                                      You've been relying on an implementation detail (and possibly undefined behavior).
                                      Let me put this into an example:

                                      static SomeClass global1 = SomeClass(0);
                                      static OtherClass global2 = OtherClass(global1);
                                      
                                      int main(...)
                                      {
                                          ...
                                      }
                                      

                                      Seems legit, right? Well it's not, the moment global2 touches global1 you're in undefined behavior land. The order of (nontrivial) statics intialization is undefined. So even if it works on 100 different platforms, it's still broke, and when the 101st actually breaks it, you don't say - "well it worked 100 times, so there's something wrong with 101st", you say "damn, I had the rotten luck of it working 100 times before it showed its ugly fangs and horns".[1]

                                      Is there special C++ syntax for iOS Simulator???

                                      Of course not, but you've not satisfied the requirements put forward by the framework - that is you've passed a local copy instead of the original variable holding the number of arguments.

                                      [1]: https://en.wikipedia.org/wiki/Thirteenth_stroke_of_the_clock

                                      B Offline
                                      B Offline
                                      bogong
                                      wrote on last edited by bogong
                                      #18

                                      @kshegunov I mean if I am wrong - OK, but why it's crashing on iOS Simulator ONLY but not everywhere? In following your explanation it should be crashing everywhere but it's not.

                                      kshegunovK SGaistS 2 Replies Last reply
                                      0
                                      • B bogong

                                        @kshegunov I mean if I am wrong - OK, but why it's crashing on iOS Simulator ONLY but not everywhere? In following your explanation it should be crashing everywhere but it's not.

                                        kshegunovK Offline
                                        kshegunovK Offline
                                        kshegunov
                                        Moderators
                                        wrote on last edited by
                                        #19

                                        @bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:

                                        @kshegunov I mean if I am wrong - OK

                                        You're wrong. But don't feel bad, we all are wrong, all the time.

                                        but why it's crashing on iOS Simulator ONLY but not everywhere? In following your explanation it should be crashing everywhere but it's not.

                                        I believe I've already answered this. Perhaps you should read my explanation again.

                                        Read and abide by the Qt Code of Conduct

                                        B 1 Reply Last reply
                                        0
                                        • B bogong

                                          @kshegunov I mean if I am wrong - OK, but why it's crashing on iOS Simulator ONLY but not everywhere? In following your explanation it should be crashing everywhere but it's not.

                                          SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #20

                                          @bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:

                                          @kshegunov I mean if I am wrong - OK, but why it's crashing on iOS Simulator ONLY but not everywhere? In following your explanation it should be crashing everywhere but it's not.

                                          That's an example of "undefined behaviour".

                                          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
                                          1

                                          • Login

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