Sharing an app you made with your friends on OSX

in answer to a question on a youtube video I made with the AsciiVideo example…

from @tracyblack

“Hello. I went through this tutorial and everything worked great, but when I sent the app to a friend, the ascii doesn’t work. How would I make this a standalone app that can be downloaded and played? I am working with Xcode on Mojave. Sorry if this is an obvious newbie question, and thank you for this tutorial!”

answer 1:

Hi Tracy - really happy to hear you are following the videos and finding them helpful. When you compile this app on Mac OSX you will find the compiled binary executable file (the app) in the ‘bin’ folder in your project folder - the app also looks into the ‘data’ folder there to find the font it loads. If you send the data folder and it’s contents with the app (you could duplicate and rename the ‘bin’ folder with all it’s contents and then compress it as a zip file to send to friends) so when your app starts it can still find the things it needs inside the ‘data’ folder - hope this works and I’m very happy for any questions ! (and feedback!) try this and let me know how you get on - i’m very happy to do a quick video walk thru on sharing what you make with your friends !

from @tracyblack

@dan buzzo Thank you so much for your quick response! I just tried this, but the app still doesn’t do the ascii effect on my friend’s computer. Maybe I’m doing something wrong. Is compiling the binary the same as choosing “Run” from the menu? Is that a very stupid question? Thank you again for your generosity!

answer 2 :
Hi Tracy, Yes - the ‘run’ button in xcode is badly named - it compiles your c++ code to create a binary application (and saves the new app in your project’s ‘Bin’ folder) and then it open or ‘runs’ it. when you compile your app Xcode has loads of settings for things like what version of OSX it will run on and so on - depending on your OSX version and your friends version there are sometimes some differences to bear in mind about how the OS (and Apple) want you to be allowed to share programs - some of this may be the new security measures apple have put in place - what happens when your friend runs the app ? does it run and not show the ascii or not show the video? maybe post a thread in the openframeworks forum

back from @tracyblack
@dan buzzo Hi, and thank you again! It runs and shows the video, as well as reacts to the mouse movement when he runs it. The ascii effect is the only thing that doesn’t seem to work. i just tried running it on another computer today, and everything worked perfectly. The computer does have OF installed, whereas my friend’s does not. Could that be the problem? Will others that i send the application to need to have OF installed on their computers?

answer 3:

Hi Tracy, if all the rest of it works OK then that is a great start to debugging it - it sounds like it is not being able to load the truetype font being used for the ascii letters in the setup where it says

 font.load("Courier New Bold.ttf", 9);

check if this font file is in the app/bin/data folder when you send it to your friend (you might be using a different named font in here) (BTW I saw your reply on openframeworks forum - thanks !) - i’ll start a thread there and then I can post screenshots etc to you :smiley:

in the github repo for this

there is a zip file with a compiled osx app in it - does this work for you?

Thank you Dan! I checked that the font file is in data folder, and checked the font.load() line. It seems ok, and like i said, runs properly on another computer i have. I also tried a different font to see if that would work, but the results are the same. Also, thank you for the screenshot of the file structure! Very helpful.

agh - that’s a pain - without looking at the machine and doing a bit more debug i’m not sure what to suggest - if it works on one of your other machines then we know it works…

Hi,
If the font-loading is the problem, you might find out about this by running the app from the commandline (Terminal).
You can type cd and then drag the app file into the Terminal window, then append /Contents/MacOS/ and hit enter.
For me this would be:
cd /Users/jildertviet/of_v20201026_osx_release/examples/graphics/fontsExample/bin/fontsExampleDebug.app/Contents/MacOS/
Now you can check the file that’s in this folder with ls (and hit enter)
Here it shows:
fontsExampleDebug
To run this, I type:
./fontsExampleDebug
If you’re lucky you may catch some error messages, that may help solve the problem, I see:
[ error ] ofTrueTypeFont: loadFontFace(): couldn’t find font ““verdaaana.ttf””

1 Like

one thing to know about sending an app to someone else is that apple added a feature that makes it harder to find things in the data folder – for security reasons, unsigned apps are run in a kind of jail where they don’t know where they are. (it’s called app translocation). some threads that may help

3 Likes

@zach @arturo thanks ! that explains a lot…