Search code examples
macoscrashosx-yosemite

Why does my exported Cocoa Mac application crash (or not even open) upon launch?


Using Xcode Version 7.2 on my OS X 10.10.5.

I have a Cocoa application written in Objective-C that utilizes Google's CorePlot library. When I run the app (Product --> Run), it runs perfectly fine.

However, when I archive the project (Product --> Archive --> Export --> Export as a Mac Application), and then run the created '.app' by double-clicking it, the app crashes right away without even loading.

There's no reason for it to crash; the archive was done successfully, and the first window/ViewController don't try to access saved variables that would not be present on a first run.

Basically, double-clicking the app doesn't even open the app icon in the dock or show a window being created - it's like the app won't even open.

This same crash/no loading happens when I try to open/install the app using any of the options under "Export"


Solution

  • It turns out this issue can occur if your app has trouble importing or finding certain classes/files.

    In my case, for some reason, when I opened my project and ran the app, it would find CorePlot's CorePlot.h file. However, when I archived the app and exported it to be used on other people's computers, it would not archive and export 'CorePlot.h'. As a result, my app would crash right away as it could not find 'CorePlot.h'.