Page 1 of 1
Loading Resources
Posted: Sun Jan 23, 2011 5:52 am
by observ3
My app will require loading text and image files from a resource folder. This is all working wonderfully on the desktop, but when I try to do it in iOS the files don't load...
So far I've tried accessing specialFolderPath("home") "documents", and even "library" and none are showing the files I selected for inclusion in the Standalone Application settings screen. I've already triple checked my capitalization and spelling... I just can't seem to see the files.
I'm I totally missing where the included files are being stored?
Re: Loading Resources
Posted: Sun Jan 23, 2011 12:17 pm
by ctflatt
observ3:
Try this.
You would first create a folder for the images and text, and place the resources inside. Create this folder in the same directory as your stack to maintain the relative path names of your files.
In your stack, insert a New Referenced Control, browsing to the folder you created, making sure the path is relative to the stack.
In the Standalone Settings, set the Copy Files option to copy the folder you created.
I have attached a demo stack.
Test in Simulator for iPhone 4.2, or create the mobile standalone for iPhone 4.2 to test on device.
Hope this helps.
This can also be done programmatically, but unless you specifically need to, why bother?
In your own standalone build, did you right-click the mobile app, and choose "Show Package Contents"? I found this helpful when trying what you're attempting.
In this example, you should see an images folder at the same level as the engine.
:Todd
Re: Loading Resources
Posted: Sun Jan 23, 2011 1:20 pm
by Klaus
Hi observ3,
the "included" files can be found here on iOS:
specialfolderpath("engine")
Best
Klaus
Re: Loading Resources
Posted: Sun Jan 23, 2011 2:36 pm
by observ3
Will take a look at your stack.
Thanks!
And yes, I've browsed contents before, but was confused since I named my folders "Documents" and "Library"... so I figured that specialFolderPath("Documents"), etc. would find them.
If I'm reading the documentation from RunRev and Apple right, everything we do must be within the Library and Document folders, right? I thought both warned against creating any folders in the "home" directory other than Documents, Library, and Cache.
Re: Loading Resources
Posted: Sun Jan 23, 2011 3:34 pm
by Klaus
Hi observ3,
please do NOT name the folders you want to "include" "Documants" and/or "Library",
which may confuse the standalone process!
And just to prevent misunderstandings:
1. specialfolderpath("Documents") will point to the already present OS folder inside of the current users HOME folder.
2. ...everything we do must be within the Library and Document folders
Everything we need to STORE during runtime should go there!
3. ...I thought both warned against creating any folders in the "home" directory other than Documents, Library, and Cache.
These folders are already present in the current users HOME directory (except "Cache") and thus cannot be created by your app!
Best
Klaus
Re: Loading Resources
Posted: Sun Jan 23, 2011 4:53 pm
by observ3
Thank you so much for clearing this up!
Re: Loading Resources
Posted: Tue Jan 25, 2011 11:10 am
by ctflatt
observ3:
Glad you're on your way. BTW, I copied this from the iOS Release Notes documentation:
Each application in iPhoneOS is stored in its own 'sandbox' folder (referred to as
the home folder. An application is free to read and write files within this folder and its descendants,
but is not allowed to access anything outside of this.
Klaus points out that anything you need to STORE (and eventually backup—new files, preferences, etc.) should be saved to the "documents" folder... folder names are case sensitive.
Good luck, and keep us informed of your progress!
:Todd