【发布时间】:2014-03-03 08:08:14
【问题描述】:
我正在尝试在实际设备 iPhone 5s iOS 7.0.6 上运行 phonegap(3.3.0)+requirejs 应用程序。它按预期在模拟器上完美运行,但在设备上没有显示任何内容。
这是我的 requirejs 数据主文件。
require(["fastclick", 'backbone', 'app/router','app/namespace'], function (FastClick, Backbone, AddaRouter, App) {
"use strict";
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady(){
FastClick.attach(document.body);
var router = new AddaRouter();
Backbone.View.prototype.goTo = function (loc) {
router.navigate(loc, true);
};
Backbone.history.start({ silent: true });
// check is the user is new. Is new then go to signup page
window.localStorage.removeItem("isNew");
if(!window.localStorage.getItem("isNew")){
router.navigate('registration', true);
}else{
if(Api.createSession()){
router.navigate('contacts', true);
}else{
router.navigate('registration', true);
}
}
}
});
注意:如果我在 require 块之外保留任何东西,它可以在设备上运行。
【问题讨论】:
-
您是否尝试过插入一堆 alert() 语句来查看代码失败的地方并在设备上运行它?