Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Crash when double clicked file to open App in Mac OS
Forum Updated to NodeBB v4.3 + New Features

Crash when double clicked file to open App in Mac OS

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 2 Posters 2.9k 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.
  • joeQJ joeQ

    I am true, i get into trouble which is same with this topix 5 years before.

    I just want to finish the function that user can double clicked file to open application. I searched the solution from internet. like

    stackoverflow
    QFileOpenEvent

    Every thing looks good, when i clicked qt debug button to run my demo, app startup. it is running well. I also drag one file to dropped on the Dock icon of the application. My app get the file path. I also use the mouse on file, right button, chose open, ok, also can get the file path. this, i tried double clicked file, it can also get file path.

    But,

    when i close the app. I tried double clicked file to startup app. It Crash. just like 5 years before.

    1. what i wrong? How to resolve it ?
    2. where is i can find QtSDK in Demos/4.7/browser? I had find Qt4.7 at here
    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by jsulm
    #2

    @joeQ It is not clear to me: do you double click your executable to start your app?
    If so, then you need to deploy your app first to make this work. See here: http://doc.qt.io/qt-5/osx-deployment.html
    Your app is not starting outside of QtCreator because the OS cannot find needed libraries (QtCreator prepares the environment before starting an app, so it is working there).

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

    joeQJ 2 Replies Last reply
    1
    • jsulmJ jsulm

      @joeQ It is not clear to me: do you double click your executable to start your app?
      If so, then you need to deploy your app first to make this work. See here: http://doc.qt.io/qt-5/osx-deployment.html
      Your app is not starting outside of QtCreator because the OS cannot find needed libraries (QtCreator prepares the environment before starting an app, so it is working there).

      joeQJ Offline
      joeQJ Offline
      joeQ
      wrote on last edited by
      #3

      @jsulm double clicked specific extension file eg: *.pro , if you double clicked *.pro file, you can startup qtcreate app.

      I double clicked eg. a.abc file, to startup my app.

      Just do it!

      1 Reply Last reply
      0
      • jsulmJ jsulm

        @joeQ It is not clear to me: do you double click your executable to start your app?
        If so, then you need to deploy your app first to make this work. See here: http://doc.qt.io/qt-5/osx-deployment.html
        Your app is not starting outside of QtCreator because the OS cannot find needed libraries (QtCreator prepares the environment before starting an app, so it is working there).

        joeQJ Offline
        joeQJ Offline
        joeQ
        wrote on last edited by
        #4

        @jsulm now i use the QFileOpenEvent in Mac OS. I writen code following the QFileOpenEvent help manual.

        Just do it!

        jsulmJ 1 Reply Last reply
        0
        • joeQJ joeQ

          @jsulm now i use the QFileOpenEvent in Mac OS. I writen code following the QFileOpenEvent help manual.

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

          @joeQ Well, then you need to debug.
          You can for example add qDebug() logs in the code where you think it crashes to localize the exact position in your code.

          Why Qt 4.7?

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

          joeQJ 1 Reply Last reply
          0
          • jsulmJ jsulm

            @joeQ Well, then you need to debug.
            You can for example add qDebug() logs in the code where you think it crashes to localize the exact position in your code.

            Why Qt 4.7?

            joeQJ Offline
            joeQJ Offline
            joeQ
            wrote on last edited by
            #6

            @jsulm I find one topix, he got the same problem like me. he said,QtSDK 4.7/Demos/browser has the some function. so i want to see the demo code.

            Just do it!

            jsulmJ 1 Reply Last reply
            0
            • joeQJ joeQ

              @jsulm I find one topix, he got the same problem like me. he said,QtSDK 4.7/Demos/browser has the some function. so i want to see the demo code.

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

              @joeQ Why not debug your app to find out where it crashes?

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

              joeQJ 2 Replies Last reply
              0
              • jsulmJ jsulm

                @joeQ Why not debug your app to find out where it crashes?

                joeQJ Offline
                joeQJ Offline
                joeQ
                wrote on last edited by
                #8

                @jsulm Debug is well, not crash.

                1. when i startup my app. then to double clicked *.abc file, my app can get the file path from QFileOpenEvent;

                2. when i close my app. then to double clicked *.abc file, want to startup my app, just like *.pro srartup qtcreate. the mac os show crash infomation.

                like the person's description 5 years before

                this case, how to debug ? only print some info to txt file.

                Just do it!

                jsulmJ 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @joeQ Why not debug your app to find out where it crashes?

                  joeQJ Offline
                  joeQJ Offline
                  joeQ
                  wrote on last edited by
                  #9

                  @jsulm This is my Info.plist file

                  <?xml version="1.0" encoding="UTF-8"?>
                  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                  <plist version="1.0">
                  <dict>
                          <key>CFBundleDocumentTypes</key>
                          <array>
                                  <dict>
                                          <key>CFBundleTypeExtensions</key>
                                          <array>
                                                  <string>abc</string>
                                          </array>
                                          <key>CFBundleTypeRole</key>
                                          <string>Editor</string>
                                  </dict>
                          </array>
                  	<key>NSPrincipalClass</key>
                  	<string>NSApplication</string>
                  	<key>CFBundleIconFile</key>
                  	<string></string>
                  	<key>CFBundlePackageType</key>
                  	<string>APPL</string>
                  	<key>CFBundleGetInfoString</key>
                  	<string>Created by Qt/QMake</string>
                  	<key>CFBundleSignature</key>
                  	<string>????</string>
                  	<key>CFBundleExecutable</key>
                  	<string>fileType</string>
                  	<key>CFBundleIdentifier</key>
                  	<string>ibigstone.fileType</string>
                  	<key>NOTE</key>
                  	<string>This file was generated by Qt/QMake.</string>
                  </dict>
                  </plist>
                  

                  Just do it!

                  1 Reply Last reply
                  0
                  • joeQJ joeQ

                    @jsulm Debug is well, not crash.

                    1. when i startup my app. then to double clicked *.abc file, my app can get the file path from QFileOpenEvent;

                    2. when i close my app. then to double clicked *.abc file, want to startup my app, just like *.pro srartup qtcreate. the mac os show crash infomation.

                    like the person's description 5 years before

                    this case, how to debug ? only print some info to txt file.

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

                    @joeQ How to debug? I already suggested how: add qDebug() logs in your code.
                    One question: does your app crash if you double click on its executable (or more generic question: does your app work outside of QtCreator?)?

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

                    joeQJ 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @joeQ How to debug? I already suggested how: add qDebug() logs in your code.
                      One question: does your app crash if you double click on its executable (or more generic question: does your app work outside of QtCreator?)?

                      joeQJ Offline
                      joeQJ Offline
                      joeQ
                      wrote on last edited by
                      #11

                      @jsulm I think, I used wrong my Info.plist content.I am new bird for Mac OS, I don't know well about the info.plist. Ok, I wiil spend some time to get it well. Thank u very much.

                      oh, my app worked outsied of QtCreator. so I this case, i think use the write log file is the only way to debug app not the qDebug("----").

                      Just do it!

                      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