Phonegap plugins not working on first run

一个人想着一个人 提交于 2019-12-11 06:23:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!