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

1 Comment »

  1. I used to be suggested this blog through my cousin. I
    am no longer sure whether this publish is written by means
    of him as nobody else realize such precise approximately my
    problem. You’re wonderful! Thanks!

    Comment by https://thehitcommunity.org/ankara-yenimahalle-devlet-hastanesi, — May 27, 2020 @ 9:41 pm

Leave a comment