问题
I created a PhoneGap iOS app and for some weird reason all of my plugins (Inappbrowser, SMSBuilder & SocialSharing) dont work on first run of app after installed. only after closing the app and opening again, everything works correctly.
Thanks!
回答1:
You really should be using a Single Page Architecture for PhoneGap, not doing so is a sure way to get rejected from AppStore anyway.
You don't want people to sit through load times between webpages, check out Handlebars.js for an easy way to do this + you should check out this tutorial which covers the basic use of SPA/PhoneGap. http://coenraets.org/blog/phonegap-tutorial/
I would advice against JQuery Mobile as that is noticeably slower on underperforming devices, and also one of those things that does not differentiate your app from a simple webpage.
回答2:
From here: PhoneGap API Documentation: deviceready.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Now safe to use device APIs
}
"This event is essential to any application. It signals that Cordova's device APIs have loaded and are ready to access."
来源:https://stackoverflow.com/questions/20613557/phonegap-plugins-not-working-on-first-run