I am developing an app for both Android and iOS platforms.
My app has many images too which have an external src's.
When the connection is there the images are displayed properly.
Now when i close the app, go to airplane mode and start the app, the images are displayed from browser cache in Android, but not in iOS ? So does the iOS clear browser cache after the phonegap app is closed and Android does not? or am i missing something here?

- 1
- 9
- 49
- 72
3 Answers
There's some information about it in this question. (I'm assuming you're using a UIWebView.) However, at the time that question was written, they were running into some bugs in the iPhone's URL cacheing system — I don't know if those bugs have since been fixed.

- 1
- 1

- 16,250
- 3
- 42
- 65
If you are talking about the cache directory obtained like this
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachePath = [paths objectAtIndex:0];
it used to be left intact but can be cleared since iOS 5, see this related post. Apple are fixing this issue in beta versions of iOS (giving the possibility of permanent cache files which are not synced to iTunes or iCloud).
you need to create a manifest.php on your repo HTML and load for the primary HTML file in your phoneGap app, this is the way to see a web app in cache and also during the divice is offline.
tha's the code for the php file:
<?php
header('Content-Type: text/cache-manifest');
echo "CACHE MANIFEST\n";
$hashes = "";
$dir = new RecursiveDirectoryIterator(".");
foreach(new RecursiveIteratorIterator($dir) as $file) {
if ($file->IsFile() && $file != "./manifest.php" && substr($file->getFilename(), 0, 1) != ".") {
echo $file . "\n";
$hashes.= md5_file($file);
}
}
echo "# Hash: " . md5($hashes) . "\n"; ?>
and this is the code need on your html file on the top to begin a code in the page:
<html manifest="manifest.php">
Enjoy.

- 1,087
- 12
- 29