You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Kerri Shotts (JIRA)" <ji...@apache.org> on 2017/01/25 04:58:26 UTC

[jira] [Commented] (CB-12376) IOS log issues

    [ https://issues.apache.org/jira/browse/CB-12376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15837202#comment-15837202 ] 

Kerri Shotts commented on CB-12376:
-----------------------------------

From the documentation (https://github.com/apache/cordova-plugin-console):

{quote}
Although the object is in the global scope, features provided by this plugin are not available until after the deviceready event.
{quote}

If you are seeing logs after {{deviceready}}, the plugin is working as it should.

Please clarify what you mean by "code added after"? Please share reproducible examples as well.

> IOS log issues
> --------------
>
>                 Key: CB-12376
>                 URL: https://issues.apache.org/jira/browse/CB-12376
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 6.4.0
>         Environment: macOS Sierra 10.12.2
> Xcode 8.2.1
>            Reporter: Sami Silmani
>
> Logging in ios doesn't work event after adding the plugin cordova-plugin-console
> steps to reproduce the bug:
> {code}
> cordova create myApp com.cordova.myApp
> cd myApp/
> cordova plugin add cordova-plugin-console
> cd www
> vi js/index.js 
> cordova emulate ios
> {code}
> in index.js i added 3 console.logs only the on device ready and Received Event are displayed on the xcode console log, all the others on the index.js and the code added later doesn't work, the log works fine on android.
> {code:title=index.js|borderStyle=solid}
> console.log("starting log");
> var app = {
>     // Application Constructor
>     initialize: function() {
>         document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
>         console.log("init function");
>     },
>     // deviceready Event Handler
>     //
>     // Bind any cordova events here. Common events are:
>     // 'pause', 'resume', etc.
>     onDeviceReady: function() {
>         this.receivedEvent('deviceready');
>         console.log("on device ready");
>     },
>     // Update DOM on a Received Event
>     receivedEvent: function(id) {
>         var parentElement = document.getElementById(id);
>         var listeningElement = parentElement.querySelector('.listening');
>         var receivedElement = parentElement.querySelector('.received');
>         listeningElement.setAttribute('style', 'display:none;');
>         receivedElement.setAttribute('style', 'display:block;');
>         console.log('Received Event: ' + id);
>     }
> };
> app.initialize();
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org