![](/img/trans.png)
[英]Uncaught Error: Couldn't load file:///android_asset/www/less/app.less (200) at file:///android_asset/www/js/lib/less.js:15
[英]Uncaught TypeError: Cannot read property 'connection' of undefined at file:///android_asset/www/app.js:1
我不知道错误在哪里以及如何删除它。 我是sencha touch和phonegap的新手。 这是我的app.js文件
//不要删除 - Sencha Cmd包需要此指令才能工作。 // @ require @packageOverrides
// Ext.Loader.setPath({'Ext':'touch / src'}); //
Ext.application({
name: 'appointMeDr',
requires: [
'Ext.MessageBox','Ext.device.Connection','appointMeDr.SessionInfo',
'Ext.data.proxy.LocalStorage','Ext.data.proxy.LocalStorage'
],
views: [
'Main','homePage.Home','viewsTab.FindDrTab','viewsTab.SettingTab',
'profile.user_profile','userAppointment.PatientAppointment',
'doctorViews.MainDr','doctorViews.drAppointment.DrAppointment','doctorViews.doctorProfile.BlockPatient',
'doctorViews.tabViews.DrProfileTab',
'MyPicker','Utils',
'signUp.UserSignUp','signUp.SignUp',
'guardianView.GuardianPatient','guardianView.guardianProfile.GuardianProfile','guardianView.MainGuardian',
'attendant.MainAttendant','attendant.tabViews.AttendantProfileTab','HealthyTips'
],
models:[
'SearchDr','fixedAppointment','Patient','Login','user','DoctorModel','AppointmentModel','Guardian','DoctorDetail',
'doctorAppointment','Attendant','HealthyTipModel'
],
stores:[
'SearchDocResults','AppointmentResults','Patients','Users','OfflineUser','Doctors','Guardians','DoctorDetailsStore',
'doctorAppointments','AttendantStore','BlockPatients','TimeSlots','HealthyTips'
],
controllers: [
'LoginController','MainController','DoctorController','UserSignUp','AppointmentController','AttendantController',
'GuardianController'
],
icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
'114': 'resources/icons/Icon@2x.png',
'144': 'resources/icons/Icon~ipad@2x.png'
},
isIconPrecomposed: true,
startupImage: {
'320x460': 'resources/startup/320x460.jpg',
'640x920': 'resources/startup/640x920.png',
'768x1004': 'resources/startup/768x1004.png',
'748x1024': 'resources/startup/748x1024.png',
'1536x2008': 'resources/startup/1536x2008.png',
'1496x2048': 'resources/startup/1496x2048.png'
},
launch: function() {
// Destroy the #appLoadingIndicator element
// Ext.fly('appLoadingIndicator').destroy();
Ext.Viewport.add(Ext.create('appointMeDr.view.homePage.Home'));
// Initialize the main view
// Ext.Viewport.add(Ext.create('appointMeDr.view.Main'));
},
onUpdated: function() {
Ext.Msg.confirm(
"Application Update",
"This application has just successfully been updated to the latest version. Reload now?",
function(buttonId) {
if (buttonId === 'yes') {
window.location.reload();
}
}
);
}
});
我们不知道你想做什么,但我尝试了一些事情:
我想你在“ deviceready ”事件之前调用connection.type属性。
来自phonegap doc:
这是每个Cordova应用程序都应该使用的非常重要的事件。
Cordova包含两个代码库:本机代码和JavaScript代码。 在加载本机代码时,会显示自定义加载图像。 但是,只有在DOM加载后才会加载JavaScript。 这意味着您的Web应用程序可能会在加载之前调用Cordova JavaScript函数。
一旦Cordova满载,Cordova deviceready事件就会发生。 设备触发后,您可以安全地调用Cordova功能。
试试这个:
// Wait for PhoneGap to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is loaded and it is now safe to make calls PhoneGap methods
//
function onDeviceReady() {
checkConnection();
}
function checkConnection() {
var networkState = navigator.network.connection.type;
...
}
编辑 :现在我们有更多的信息,我认为这个答案对你没用:/
经过2天的艰苦努力,我自己解决了。即使“”,“”(逗号生成它)也可以发出所有警告。 问题解决了:)快乐的编码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.