phoneGap issues
Guys I have this peace of code I'm using phonegap with jqueryMobile to develop cross platform apps.
The initialized function is called when the page loads the alert start pops up
BUT function "populateDB" is never called, neither the success or the error methods are called
!!
function Initialize()
{
alert("start");
db = window.openDatabase("YahooMovies", "1.0", "Yahoo Movies", 200000);
db.transaction(populateDB, DB_Error, updateDb);
}
function 开发者_StackOverflow社区populateDB(tx)
{
alert("initSql");
tx.executeSql('DROP TABLE IF EXISTS tblMovies');
tx.executeSql('CREATE TABLE IF NOT EXISTS tblMovies (Id unique, Title, EpisodeNum, PubDate, PoweredBy, VideoURL, ImageUrl, CategoryId, Restriction, keywords, Text, Adult, Actors, Director, Writer, Producer, Visitor, Album, Artist)');
}
No emulator will ever be able to perfectly articulate the actions of a device, especially if the two are based on different architectures. If you're talking about iOS emulation, believe me, an emulator's response should never be indicative of a device's response. iOS itself compiles for three different architectures: armv6
, armv7
, and i386
.
That being said, if it is working on your device and not your emulator, do not fret. After all, it is the device that counts. No one will be using the application in an emulator except for you.
EDIT: Whoops, just saw that android tag. Same thing applies!
Most Likely a typo in one of your Function Names - updateDb - Has a lowercase "b" while your other Vars have Caps.
This code works for me:
`function populateDB(tx)
{
alert("initSql");
tx.executeSql('DROP TABLE IF EXISTS tblMovies');
tx.executeSql('CREATE TABLE IF NOT EXISTS tblMovies (Id unique, Title, EpisodeNum, PubDate, PoweredBy, VideoURL, ImageUrl, CategoryId, Restriction, keywords, Text, Adult, Actors, Director, Writer, Producer, Visitor, Album, Artist)');
}
function DB_Error(tx)
{
alert("error");
}
function updateDb(tx)
{
alert("updateDb");
}`
精彩评论