Loading Resources
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Loading Resources
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?
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?
Check out my LiveCode program, WriteSpire, on the App Store!
Re: Loading Resources
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
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
- Attachments
-
- referenced_images.zip
- Demo showing referenced control for images for iOS.
- (33.97 KiB) Downloaded 312 times
Re: Loading Resources
Hi observ3,
the "included" files can be found here on iOS:
specialfolderpath("engine")
Best
Klaus
the "included" files can be found here on iOS:
specialfolderpath("engine")
Best
Klaus
Re: Loading Resources
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.
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.
Check out my LiveCode program, WriteSpire, on the App Store!
Re: Loading Resources
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
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
Thank you so much for clearing this up!
Check out my LiveCode program, WriteSpire, on the App Store!
Re: Loading Resources
observ3:
Glad you're on your way. BTW, I copied this from the iOS Release Notes documentation:
Good luck, and keep us informed of your progress!
:Todd
Glad you're on your way. BTW, I copied this from the iOS Release Notes documentation:
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.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.
Good luck, and keep us informed of your progress!
:Todd