Qt 5.6.0 app fails to launch with OSX 10.11 App Sandbox enabled - can't find cocoa plugin
I'm trying to deploy my QT OSX app to the Apple Store. However, one of the preconditions seems to involve enabling the App Sandbox in the Capabilities section of XCode (I'm using v 7.0 beta 6). After enabling this option, my app will compile but refuse to run, with the following error:
This application failed to start because it could not find or load the Qt platform plugin "cocoa" in "".
I've tried to run the app from xcode, and after building a deploy version with
/usr/local/Cellar/qt5/5.6.0/bin/macdeployqt My.app, but both throw the same error.
/usr/local/Cellar/qt5/5.6.0/plugins/platforms/libqcocoa.dylibdoes exist and gets included in the .app bundle when
Any help is appreciated!
I have to add the lines below before instantiating QApplication in my main.cpp. Check what you get when you uncomment the printf.
QDir dir(argv); dir.cdUp(); dir.cdUp(); dir.cd("PlugIns"); QApplication::setLibraryPaths(QStringList(dir.absolutePath())); //printf("libraryPaths=%s\n", QCoreApplication::libraryPaths().join(",").toUtf8().data()); QApplication a(argc, argv);