Important: Please read the Qt Code of Conduct -

Qt5 XCode 4.5 SandBoxing Failed to load platform plugin "cocoa" on both Debug and Release

  • Hi,

    Mac OS X Lion
    XCode 4.5.2
    Qt 5.0
    Simple test app with a main window and a toolbar

    When I use SandBoxing in XCode 4.5 (I checked the boxes) I get the following error on both Debug and Release "schemes":

    Failed to load platform plugin "cocoa". Available platforms are:

    ...and the app just hangs.

    EDIT: QUESTION IS: Where is one supposed to place the Qt Frameworks and plugins when using the SandBox on a Mac? I see a lot of stuff is in the app "container" Data folder but where do you put the additional frameworks that the app is supposed to use? Once I know that, I can try to relink the executable using install_name_tool. Is there a guide and a sample XCode project anywhere guys? Isn't XCode supposed to place them automatically where they belong and isn't it supposed to relink the binaries correctly WHEN using the SandBox? Google returned zilch on the topic.

    qDebug() << QApplication::libraryPaths(); returns:
    ("/Volumes/Misc/Qt/Qt5.0.0/5.0.0/clang_64/plugins") i.e. I have installed the LGPL Qt5.0 on an external HD (if that matters).

    EDIT: I then changed the plugins directory to the container Data folder and I got:
    Failed to load platform plugin "cocoa". Available platforms are:
    So, it is definitely seeing the plugin now but it may be missing the correct paths to the Qt frameworks. Side note: This plugin technology Qt uses and has increased using with Qt5 is a little messy. I've had strange problems in the past where the plugins load on some Macs and on some they don' go and debug that. Same thing happened less often on Windows. Why would you make Cocoa as a plug-in? Weird.

    I have tried relinking the binaries, frameworks and the cocoa plugin using install_name_tool to a Framework and a plugins folder within the app folder - no luck (I get a Killed: 9 in Terminal).

    When I uncheck the SandBoxing in XCode 4.5 all works fine. But we do need SandBoxing for the App Store, right?

    I'm on a Mac Lion.

    This has probably nothing to do with the recently fixed bug of that sort that caused such a problem on Debug builds only.

    My app does not exit after the error it just hangs and nothing shows up.

    What am I doing wrong? It is the simplest test app with a window and a toolbar.

    ***Maybe someone could send me a test XCode 4.5.2 project that works with SandBoxing.

    Please help!
    Thank you!


    Basically before QApplication init I called QApplication::setLibraryPaths to pijnt to the correct Plugins directory in the bundle.


    SandBoxing is a nightmare.

Log in to reply