没有设备准备好和没有console.log与xcode使用cordova 1.5 [英] no device ready and no console.log with xcode using cordova 1.5

查看:177
本文介绍了没有设备准备好和没有console.log与xcode使用cordova 1.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是所有的代码,我没有得到既没有日志在xcode也没有deviceReady事件(我没有得到在任何其他平台上。在Ubuntu + Android + Eclipse我得到控制台日志,但没有deviceReady,也没有chrome)



js / cordova-1.5.0.js存在并加载,表示我在其中放置的警告语句。
任何线索我应该在哪里看?
提前感谢;)

 < div id =d>< / div& 
< script>
function foo(){console.log('test'); document.getElementById('d')。innerHTML + ='called';}
window.setTimeout(foo,5000);
window.setTimeout(foo,15000);
window.setTimeout(foo,25000);
window.setTimeout(foo,35000);
alert('hi');
console.log('non timed console.log');

< / script>
< script src =js / cordova-1.5.0.js>< / script>
< script>
document.addEventListener(deviceready,onDeviceReady,false);

function onDeviceReady(){
alert('deviceReady');
//这样永远不会发生
}

< / script>

解决方案


  1. Console.log仅在deviceReady事件


  2. Phonegap对android和ios使用不同的phonegap.js文件,只有
    Android系统可以下载档案。阅读
    Dhaval的评论,学习在哪里得到ios版本。


  3. 我使用Weinre进行调试,几乎错过了它覆盖了console.log方法,
    因此console.log不能使用weinre



This is all the code I have and I do not get neither the logs in xcode nor the deviceReady event (which I don't get on any other platform either. On Ubuntu+Android+Eclipse I do get the console logs, but no deviceReady. nor in chrome )

The js/cordova-1.5.0.js exists and being loaded as indicates an alert statement i've put in there. Any clues where should I look ? Thanks in advance ;)

<div id="d"></div>
<script>
    function foo() {console.log('test'); document.getElementById('d').innerHTML += 'called';}
    window.setTimeout(foo, 5000);
    window.setTimeout(foo, 15000);
    window.setTimeout(foo, 25000);
    window.setTimeout(foo, 35000);
    alert('hi');
    console.log('non timed console.log');

</script>
<script src="js/cordova-1.5.0.js"></script>
<script>    
    document.addEventListener("deviceready", onDeviceReady, false);

    function onDeviceReady() {
        alert('deviceReady');
        //somewhy this never happens
    }

</script>

解决方案

  1. Console.log works only after deviceReady event

  2. Phonegap uses different phonegap.js files for android and ios, and only the android one is distributed with the downloadable archive. Read Dhaval's comment to learn where to get the ios version.

  3. I used Weinre for debugging and almost missed that it overrides the console.log method, therefore console.log doesn't work with weinre

这篇关于没有设备准备好和没有console.log与xcode使用cordova 1.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆