Create a file in an OpenFrameworks iOS app and access it from your computer
... if your application saves for example images or text files that you'd like to get out of your iOS device.
First, as a reminder, that's how you typically write a local file in OpenFrameworks:
ofFile file; file.open("myfile.txt", ofFile::WriteOnly, true); file << "poupoupidou" << endl;
To get the files stored in the sandboxed world of iOS, you must first make sure you write the file in the "documents" folder of your app.
You get the path of that folder with ofxiPhoneGetDocumentsDirectory(), so your file.open will be
file.open(ofxiPhoneGetDocumentsDirectory() + "myfile.txt", ofFile::WriteOnly, true);
The files locally stored on your iOS device can only be downloaded from the device through iTunes (yes, iTunes!). You must enable this feature in your ofxiphone-Info.plist file (in the openFrameworks folder of your project). Click on the (+) next to Information Property List and add "UIFileSharingEnabled". Xcode should automatically replace it by "Application supports iTunes file sharing", by default set as NO. Just set it to YES.
Once you have run your app on your device, start iTunes, select your device and go to the App tab. Scroll to the bottom.
and from there you can download your file!
Info
Difficulty: ●●○○○
Last updated: November 2012