【问题标题】:Phonegap app does not run on iPhone iOS 7Phonegap 应用程序无法在 iPhone iOS 7 上运行
【发布时间】: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() 语句来查看代码失败的地方并在设备上运行它?

标签: ios cordova requirejs


【解决方案1】:

我发现了问题所在。它是其中一个 js 文件的名称。由于我的文件系统不区分大小写,因此在模拟器中未检测到。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多