Standalone app crashes when moved to another folder

Hi I built a standalone app in xcode by going product->build for->running. Then when I run it in the project folder it works alright but when I move it for example to desktop and run it from there it crashes. I have a image loader in the project so it loads images to vector. So I guess why it is crashing is because it is still linking to the project folders files? Just a guess though. So how to build a standalone app properly in xcode? I did it once before but can’t remember any more, but I remember but it was more complex than just going product->build for etc. Couldn’t find an answer from here. Thanks in advance!

Just in case here’s my code for the loader:

in ofApp.h:

vector <ofImage> pics;
ofDirectory dir;

in ofApp.cpp:

//loading pictures
for (int i = 0; i < dir.size(); i++) {

Alright so I tested to move the data folder from the project folder to the desktop and then it runs alright. So the linking of the compiled app is incorrect. How to make it so that the image folder it links to is the one inside the standalone app when compiling?


Default, .app of openFrameworks refers to /oF Project/bin/data.

This is the way to link to these inside the standalone app.

  1. Add “data folder” in Build Phase > Copy Bundle Resources.

  2. Add ofSetDataPathRoot("../Resources/data/"); in ofApp::setup();

1 Like

Thanks! Where do you have the Build Phase > Copy bundle thing? I couldn’t find it in xcode. I have Xcode 7.1.1.


Oh, sorry I didn’t explain it clearly enough.

  1. Click “+” buttom
  2. Choose “New Copy Bundle Resources Phase”.