Note that there are some explanatory texts on larger screens.

plurals
  1. POWebview is not showing bundle images on ios 5.1, works on other versions
    primarykey
    data
    text
    <p>I'm developing application which shows page and images from app resources in webview. The page works fine, but the images aren't there when on iOS 5.1. When I'm testing it on iOS 4.3 or iOS 6.0 everything works like a charm; images are being shown properly. It seems like something's wrong with that exact system version. Here's the code I am using:</p> <pre><code>NSString *imgPath = [[NSBundle mainBundle] pathForResource:currentImageName ofType:@"png"]; imgPath = [NSString stringWithFormat:@"%@%@",@"file://",imgPath]; content = [content stringByReplacingOccurrencesOfString: @"{}" withString:imgPath]; myData = [content dataUsingEncoding:NSUTF8StringEncoding]; [webView loadData:myData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]]; </code></pre> <p>Content is the string with html. myData is NSData with html file. Image path is generated properly. As I mentioned before - everything works fine on iOS 4.3 and 6.0.</p> <p>Here are the values of the data on iOS 5.1 emulator:</p> <pre><code>imgPath = file:///Users/deimos/Library/Application Support/iPhone Simulator/5.1/Applications/98C3911D-46D6-49B6-BADC-6B463619EF5E/myApplication.app/pl.lproj/image01.png </code></pre> <p>content before replacing the image url:</p> <pre><code>&lt;body&gt; &lt;center&gt;&lt;img src="{}" /&gt;&lt;/center&gt; &lt;/body&gt; </code></pre> <p>content after replacing the image url:</p> <pre><code>&lt;body&gt; &lt;center&gt;&lt;img src="file:///Users/deimos/Library/Application Support/iPhone Simulator/5.1/Applications/98C3911D-46D6-49B6-BADC-6B463619EF5E/myApplication.app/pl.lproj/image01.png" /&gt;&lt;/center&gt; &lt;/body&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload