Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Crash when double clicked file to open App in Mac OS
joeQ last edited by 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
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.
when i close the app. I tried double clicked file to startup app. It Crash. just like 5 years before.
- what i wrong? How to resolve it ?
- where is i can find
QtSDK in Demos/4.7/browser? I had find Qt4.7 at here
@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).
@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.
@jsulm now i use the
QFileOpenEventin Mac OS. I writen code following the
@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?
@joeQ Why not debug your app to find out where it crashes?
@jsulm Debug is well, not crash.
when i startup my app. then to double clicked *.abc file, my app can get the file path from
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.
@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>
@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?)?
@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