Monday, October 06, 2008

iPhone Programming Tip: How to find the full URL of a file within your Application's Bundle

How to find the full URL of a file within your Application's Bundle (mainBundle)

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];

Labels: