0

I'm trying to be a good doobee and use URLs everywhere. When I invoke

(gdb) po [[NSBundle mainBundle] URLsForResourcesWithExtension:@".aif" subdirectory:nil]

<__NSCFArray 0x6a02150>(
drip.aif -- /Users/hacksaw/Library/Application Support/iPhone Simulator/4.3.2/Applications/CF4B60C1-D8E1-4CEA-B7CF-DE57F88E1023/SuperTimer.app/

Which is the right path, but not at all a URL.

Is it somehow unreasonable to expect that the array returned from this method would contain actual URLs?

What's the proper way to find all my .aif's I included with my bundle?

Hack Saw
  • 2,741
  • 1
  • 18
  • 33

1 Answers1

3

This is an NSURL. When you print them out in the debugger with po, they just show their description, which is the name of the file, two hyphens and the name of the directory. But it's an NSURL.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610
  • Seems true enough, I guess my problem is elsewhere. Though I do have to say that this representation leaves something to be desired. – Hack Saw Jun 10 '11 at 03:11
  • 1
    I bet that `description` for file-URL was written by someone who had to look at hundreds of files that were all in a small number of directories, and he figured it would be nice to put the really critical information (the name) at the beginning rather than the end. Sometimes that's very useful, sometimes less so. It's just the debug string, though. For single URLs you get an URL-ish string with `absoluteString`. For an array of them, you have to use higher order messaging, which NSArray doesn't provide (which always stuns me). Everyone builds it: http://stackoverflow.com/questions/4579137 – Rob Napier Jun 10 '11 at 03:25