This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requirejs(['cordova.js'], | |
function () { | |
// start of require | |
// cordova is now available globally | |
var exec = cordova.require('cordova/exec'); | |
var app = { | |
// Application Constructor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="format-detection" content="telephone=no" /> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> | |
<link rel="stylesheet" type="text/css" href="css/index.css" /> | |
<title>Hello World</title> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create a new project | |
2. Copy in your www assets (keep the cordova.js that is in the new) | |
3. Update your .html pages that reference the cordova.js to the new one | |
4. Copy in your Plugin source files into the Plugins group in Xcode | |
5. Update config.xml with your plugin mappings, access tags (whitelist), and application preferences | |
6. Copy in any [App]-Info.plist settings that you had before (99.99999% of the cases you can just copy it over if you created the new project with the same settings) | |
7. localization files - copy those folder over and register them in XCode - as we have the app in 4 languages | |
8. icons - overwrite the cordova ones and re-register them in XCode | |
9. splashscreens - ditto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFileEntry(localFileSystem, filePath, onGetFileWin, onGetFileFail) | |
{ | |
var onFSWin = function(fileSystem) { | |
fileSystem.root.getFile(filePath, {create: true, exclusive: false}, onGetFileWin, onGetFileFail); | |
} | |
var onFSFail = function(evt) { | |
console.log(evt.target.error.code); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// warning, jQuery code below | |
$(document).ready(function() { | |
var $a = $("a"); | |
$a.click(function(x) { | |
x.preventDefault(); | |
var url = $(this).attr('href'); | |
launchUrl(url); // where launchUrl is your function that calls window.open, etc | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("deviceready", onDeviceReady, false); | |
// Cordova is ready to be used! | |
// | |
function onDeviceReady() { | |
// do stuff here | |
var exec = cordova.require('cordova/exec'); | |
exec.setJsToNativeBridgeMode(exec.jsToNativeModes.IFRAME_NAV); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
if (typeof String.prototype.startsWith != 'function') { | |
String.prototype.startsWith = function (str){ | |
return this.slice(0, str.length) == str; | |
}; | |
} | |
function launchUrl() { | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="format-detection" content="telephone=no" /> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" /> | |
<title>Hello World</title> | |
<script type="text/javascript" src="cordova-2.1.0rc1.js"></script> | |
<script type="text/javascript"> | |
document.addEventListener("deviceready", onDeviceReady, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while :; do curl https://issues.apache.org/jira 2>/dev/null | (grep "Maintenance in progress" || say "The Apache Jeera Site is back online.") | grep -v "<h1>Maintenance in progress</h1>"; sleep 300; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fundamentally, this is a WebKit bug that cannot be worked around currently (it does not release memory of images that a not used anymore). I did extensive measurements by loading huge images in a previous project, and it consistently crashes because of this bug. | |
I believe it has been reported to the WebKit project, with no resolution: | |
https://bugs.webkit.org/show_bug.cgi?id=31253 | |
https://bugs.webkit.org/show_bug.cgi?id=39628 | |
Usually, setting the image src to null I think would flag the gc to recycle the memory, but I don't think it will work because of this bug. | |
Others have the same problem, from the Apple Dev Forums (login needed): | |
https://devforums.apple.com/search.jspa?resultTypes=MESSAGE&q=UIWebView+memory&peopleEnabled=true&start=1&dateRange=all |