TIP: How to find the full URL of a file within your Application’s Bundle

Posted on June 19, 2009 by David Hilowitz

iPhone Icon 79 x 130This is an iPhone Programming tip. Say you want to find  the full URL of a file within your Application’s Bundle (mainBundle), here’s how you would do it. Example: This would return the full URL of a file named “Sound2.caf”:

CFURLRef fileURL;
NSString *path;
path = [[NSBundle mainBundle] pathForResource:@"Sound2" ofType:@"caf"];
fileURL = (CFURLRef)[NSURL fileURLWithPath:path];

No Comments »

No comments yet.

Leave a comment