I’m trying to compile my phonegap (1.0.0) application under XCode 4.2 (Mac OS X 10.6.8).
Using 5.0 iPhone/iPad Simulator everything seems to work fine, but if I use versions under 5.0 (4.0, 4.1, 4.2, 4.3) then nor iPhone nor iPod simulators returns the database Object invoking openDatabase() method, it simply returns null (I’m using alert to retrieve the value).
Although live iPad 4.3.1 device behaves the same way. I can forget about the simulators, but I need my application to work properly on 4 and 5 iOS devices.
Here is a sample code:
<!DOCTYPE html>
<html>
<head>
<script src="phonegap-1.0.0.js"></script>
<script>
var db = window.openDatabase("TMA", "1.0", "TMA Mobile Database", 1024 * 1024 * 10);
alert(db);
</script>
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
</head>
<body>
</body>
</html>
Any ideas where the bug may dwell? May be some XCode settings or there is a version conflict?
The problem was resolved. openDatabase() method throws an exception (SECURITY_ERR: DOM Exception 18) and returns null when the database size over 5 MB.