Unable to open Safari through app
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2582634/iphone-mobile-safari-file-system-access">iPhone Mobile Safari File System Access</a>  </p>
</blockquote>



<p>I want to open a locally saved image in Safari through my app.</p>

<p>When my app loads, I place an image in "/Users/username/Pictures/xxx.jpg". If I open Safari directly and enter "file:///Users/username/Pictures/xxx.jpg" or "file://localhost/Users/username/Pictures/xxx.jpg", the image opens in the browser.</p>

<p>But if I try to open Safari through my app, neither Safari, nor the image opens. Following is the code I use to open Safari through my app.</p>

<p><code>
    NSString *str = [NSString stringWithFormat:@"file:///Users/username/Pictures/xxx.jpg"];
    str = [str stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];<br>
    NSURL *url = [NSURL URLWithString:str];<br>
    if (![[UIApplication sharedApplication] openURL:url])<br>
       NSLog(@"%@%@",@"Failed to open url:",[url description]);
</code></p>

<p>A point worth mentioning is that if I open an HTTP URL, say <a href="http://www.google.com" rel="nofollow">http://www.google.com</a>, the app opens Safari with the URL specified.</p>

<p>I'm trying this on Simulator and have not saved the image in the my apps folder just to make sure that the image is not sandboxed. Even if I place the image in my apps folder, I get the failure message.</p>

<p><strong>Please note:</strong> I'm not using a UIWebView as it will defeat the Business Requirement.</p>
