My iPhone app will have a map with about 10 points on it. It will play sound files based on the proximity to those points.
What's the best way of managing these resources?
Coordinates and accompanying sound file could be stored in a plist, as an array of dicts with latitude, longitude and file name. Then the sound files could be stored separately.
The plist and sound files should not be version controlled.
How much, and what, should happen compile-time, and run-time? How do I manage this?
The end result should be an app binary with the sound files embedded and the records stored in core data. Doing stuff on first launch of app is also OK.
I think my question could be rephrased to: how do I manage resources programatically, at build time?
Add the sounds folder as a 'folder reference'. Then any files you add to that folder will be included in your bundle. Right click on your project->Add Existing Files then choose 'Create Folder References'
Related
I'm working on a iphone application project in which, i have around 500(250mb) audio files.
When i got them from studio they were in wav format, I converted them to caf(35mb).
is there any other way/format i can compress them ?
dumping 500 audio files to iphone app resource will be good?
any suggestions?
In Storm Sim I did a folder reference for the audio samples with the files structured inside subfolders so I could keep them organized in a somewhat sane way.
Instead of using the standard get resource calls I just ask for the app's main bundle directory and the referenced folder is inside the main app folder with the appropriate subfolders under it.
Let me know if you need a code sample.
I'm looking for a good way to manage many image files in my app.
When the number of images to maintain gets large, it seems vital to have a directory structure to hold them.(to organize images and to support duplicate image names)
Since normal way of storing images in documents directory(by adding images to xcode's resource folder) doesn't seem to support directory structure,
I probably need to use something called bundle.
Here are questions.
It's not clear to me what's the difference between "documents
directory" and "bundle". Are they
just names to specify directory path
inside an iphone application? Since
documents directory doesn't support
directory structure, I guess it's not
a regular file path in iOS? (I'm
looking for a definition or overview
description on those two terms enough
to help answering the following
questions)
How do I create a tree structure directory to store resources?
How do I add files to the created directory?
What is the step (probably in xcode) to add new files to the
directory as project grows? note:
question 3 deals with initial set up,
4 deals with update.
What happens to files under documents directory and bundle when
user updates the app? Since many
applications store user data
somewhere, there must be a way of
updating an app without wiping out the
saved user data. ie. How does
"documents directory" and "bundle"
behave in update situation?
So called "resource bundle" refers to the "bundle" used in above
questions?
Thank you.
Your app is a "bundle". It's represented by an NSBundle object. On iOS, this is the only bundle you are allowed to use; you can't create another bundle and import it into your app.
However, you can add a subdirectory to your app's bundle. In Xcode 4, select your project in the navigator and click on the Build Phases tab. Add a new build phase (bottom right), Copy Files. Move it up just below Copy Bundle Resources, and rename it something meaningful ("copy interface images", or something). You'll notice you've got a Subpath field there - that's your directory in your bundle. Drag the files you want in that subdirectory on to this build phase, and then you can access them through the normal methods in NSBundle, UIImage, NSData and so on.
Wish it was easier? Me too.
We have very huge music files in mp3 formats (very huge more than 1,000,000) and would like to import all these songs into the DB of an application we are developing. Is there any easy method to import such huge files at once. Kindly let me know
Why not just use a filesystem for them - that's what file systems are designed for? Index the filenames in a normalised DB.
Yes, there is
Take a look at how has Apple solved that problem. Go to the iTunes_control folder on the iPod. You'll see that there's a Music sub folder with dozens of folders named f00, f01, ... f50 (50 is arbitrarily big number). Every file has been renamed to a filename that looks like a hash value.
Use the file system to store the files. In the database store the path to the file on the file system together with the mp3 metadata information (artist, name, album, composer, etc) and provide search capabilities over it.
You don't want to store music into the database. Store some kind of URLs to music into the database, with all the metadata you want to keep, and store music into folders on various servers. I am author of radio automation software that used this scheme and we never looked back at our decision.
Main reason for that is that you don't want anyone to be dependent on some database API to extract the music.
Um, I working on a dictionary app and currently trying to add narration for each article. I have about 97000 AAC-files. They are tiny - about 3-5 kilobytes each, but there are so many of them! I don't need SQL DB for access management because filenames are identical to the primary keys, so given the key I will be able to pick a proper sound file from disk and play it (I expect so).
The thing I worry about are issues related to huge number of files. I don't really want to mess up with CoreData.
Will there be any problems if I just add all these files to the application bundle? Will Xcode be angry at me? Will iOS be OK with that?
If not what should I use then? How to handle huge (~100'000) number of files properly?
There is no restriction on the number of files that can be added to your application bundle.
It would be better for you if you can put the files on a folder(say audio) in the app bundle.
Right, this is the problem I have a container (rar,zip) which contains images png's tiffs bmps or jpegs in an order.
The file extension isnt zip or rar though but uses the same compression.
I want to pull out a list of images contained within the file in the numerical order, then depending on the user decision go to the image selected.
I'm not after any code just the high level thought process/logic of how this can be achieved and how it could be achieved on iphone OS.
From what i know of iphone OS it uses a kind of sandbox environment so how would this effect the process as well.
Thanks
You can include the libz framework in your project and write some C to manage zipped data. Or you can use Objective-C wrapper classes others have written.
Your application resides in its own sandbox. You can include zip files in the "bundle", i.e. add them to your project, and copy them to the application's Documents folder to work with them. Or you can copy archived data over the network to the application's Documents folder if you don't want to include files in your project.
I don't think the extension matters so much as the data being in the format you expect it to be.
Everything I wrote above is for zip-ped files. If you're working with rar-formatted archives, you'll need to look at making a static library for the iPhone, perhaps from the UnRAR source code.