title: Can I get a NSURL from an XCAssets bundle?
body: <p>I'm in a situation where I am listing attachments from a message.  Each attachment has a NSURL associated with it that represents a path to the attachment data.  In the case of non-image attachments I want to load pre-generated icon thumbnails in the place of a preview (i.e. excel documents, PDF, word, etc).</p>
  
  <p>I currently have these images in my project, within an XCAssets bundle.  I can get at them using <code>[UIImage imageNamed:@"someName"]</code>.  I cannot seem to get at them via NSBundle's various resource lookup methods.  Does the XCAssets bundle somehow change the filenames of the icon images I'm looking for?</p>
  
  <p>Here's the code I'm currently working with.  Path is nil every time.  Do I need to not use XCAssets in this case?</p>
  
  <pre><code>+ (NSURL *)mediaURLWithMessage:(SRMediaMessage*)message
  {
    NSURL *url = message.mediaURL;
  
    // if this is an image URL or non-existant, there is no work left to do, return it.
    if (!url || (message.secureFile.secureFileMimeType &amp; SRSecureFileMimeTypeImage))
      return url;
  
    NSString *filename = @"unknown";
  
    switch (message.secureFile.secureFileMimeType)
    {
      case SRSecureFileMimeTypeDOC:
        filename = @"doc";
        break;
  
      case SRSecureFileMimeTypePPT:
        filename = @"ppt";
        break;
  
      case SRSecureFileMimeTypePDF:
        filename = @"pdf";
        break;
  
      case SRSecureFileMimeTypeXLS:
        filename = @"exl";
        break;
  
      case SRSecureFileMimeTypeCSV:
        filename = @"csv";
        break;
  
      case SRSecureFileMimeTypeTXT:
        filename = @"txt";
        break;
  
      case SRSecureFileMimeTypeRTX:
        filename = @"rtf";
        break;
  
      default:
      case SRSecureFileMimeTypeMP4:
        // unknown icon for now.
        break;
  
        // unused but available:
  //      @"ilife"
  
    }
  
    NSString *path = [[NSBundle mainBundle] pathForResource:filename ofType:nil];
    if (path)
      url = [NSURL fileURLWithPath:path];
  
    return url;
  }
  </code></pre>