Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-17195

Analytics: iOS - The application has crashed with an uncaught exception 'apsanalytics.exception.notenabled'

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 3.3.0
    • Fix Version/s: Release 3.3.0, Release 3.4.0
    • Component/s: iOS
    • Environment:
    • Sprint:
      2014 Sprint 13 SDK

      Description

      App crash, when analytics set to false.
      app.js

       
      var win = Ti.UI.createWindow({backgroundColor:'white'});
      var startDate = new Date();
      if (Ti.UI.Android){win.windowSoftInputMode = Ti.UI.Android.SOFT_INPUT_ADJUST_PAN;}
       
      function timeOut(){setTimeout(function(){if(Ti.Platform.osname == 'ios' || 'android'){label.text = Ti.Analytics.lastEvent;}},1000);}
       
      function createRow(i) {
        var row = Ti.UI.createView({backgroundColor: 'white', width:'100%', height: '10%', top: 5, left: 0});
        return row;
      }
       
      var column1 = Ti.UI.createView({top: 0, left: 0, layout: 'vertical', height:"60%", width:'33%'});
      var column2 = Ti.UI.createView({top: 0, layout: 'vertical', height:"60%", width:'33%'});
      var column3 = Ti.UI.createView({top: 0, right: 0, layout: 'vertical', height:"60%", width:'33%'});
      if(Ti.Platform.osname == 'android'){
      	var label = Ti.UI.createLabel({backgroundColor:'#FFF', color:'black', textAlign: 'center', bottom:0, width: '98%', height:'40%'});}
      else{
      	var label = Ti.UI.createLabel({backgroundColor:'#FFF', color:'black', font: {fontSize: 11}, textAlign: 'center', bottom:0, width: '98%', height:'40%'});}
      var border = Ti.UI.createLabel({top:0, height:'1', borderColor:'#EEE', width: Titanium.UI.FILL});
      var deprecated = Ti.UI.createLabel({backgroundColor:'#FFF', color:'red', textAlign: 'center', bottom:0, width: Titanium.UI.FILL});
       
      //Testing the Ti.Analytics.addEvent
      var testOneButton = Ti.UI.createButton({title: "addEvent", height: '33%', color:'red', width: '100%', top: 0});
      testOneButton.addEventListener('click', function(e){
      	Ti.Analytics.addEvent('addEventOne', 'addEventTwo', 'addEvent.testButton');
      	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Add Event"; }
      	deprecated.setText("Deprecated 2.0.0");
      	win.add(deprecated);
      });
       
      //Testing the Ti.Analytics.getLastEvent
      var testTwoButton = Ti.UI.createButton({title: "getLastEvent", height: '33%', width: '100%', top: 0});
      testTwoButton.addEventListener('click', function(e){
      	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Get Last Event"; }
      	win.remove(deprecated);
      });
       
      //Testing the Ti.Analytics.getBubbleParent
      var testThreeButton = Ti.UI.createButton({title: "getBubble", height: '33%', width: '100%', top: 0});
      testThreeButton.addEventListener('click', function(e){
      	Ti.Analytics.getBubbleParent();
      	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Get Bubble Event"; }
      	win.remove(deprecated);
      });
       
      //Testing the Ti.Analytics.featureEvent
      var testFourButton = Ti.UI.createButton({title: "featureEvent", height: '33%', width: '100%', top: 0});
      testFourButton.addEventListener('click', function(e){
      	Ti.Analytics.featureEvent('featureEvent', {"value1":"key1"});
      	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Feature Event"; }
      	win.remove(deprecated);
      });
       
      //Testing the Ti.Analytics.navEvent
      var testFiveButton = Ti.UI.createButton({title: "navEvent", height: '33%', width: '100%', top: 0});
      testFiveButton.addEventListener('click', function(e){
      	Ti.Analytics.navEvent('navEventOne', 'navEventTwo', 'navEvent.testButton');
      	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Navigation Event"; }
      	win.remove(deprecated);
      });
       
      //Testing the Ti.Analytics.timedEvent
      var testSixButton = Ti.UI.createButton({title: "timedEvent", height: '33%', color:'red', width: '100%', top: 0});
      testSixButton.addEventListener('click', function(e){
      	var stopDate = new Date();
      	var duration = stopDate - startDate;
      	Ti.Analytics.timedEvent('timedEvent.testButton', startDate, stopDate, duration);
      	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Timed Event"; }
      	deprecated.setText("Deprecated 2.0.0");
      	win.add(deprecated);
      });
       
      //Testing the Ti.Analytics.settingsEvent
      var testSevenButton = Ti.UI.createButton({title: "settingsEvent", height: '33%', color:'red', width: '100%', top: 0});
      testSevenButton.addEventListener('click', function(e){
      	Ti.Analytics.settingsEvent('settingsEvent', 'settingsEvent.testButton');
      	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Settings Event"; }
      	deprecated.setText("Deprecated 2.0.0");
      	win.add(deprecated);
      });
       
      //Testing the Ti.Analytics.userEvent
      var testEightButton = Ti.UI.createButton({title: "userEvent", height: '33%', color:'red', width: '100%', top: 0});
      testEightButton.addEventListener('click', function(e){
      	Ti.Analytics.userEvent('userEvent', 'userEvent.testButton');
      	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "User Event"; }
      	deprecated.setText("Deprecated 2.0.0");
      	win.add(deprecated);
      });
       
      //Testing the Ti.Analytics.setBubbleParent
      var testNineButton = Ti.UI.createButton({title: "setBubble", height: '33%', width: '100%', top: 0});
      testNineButton.addEventListener('click', function(e){
      	Ti.Analytics.setBubbleParent(true);
      	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Set Event"; }
      	win.remove(deprecated);
      });
       
      column1.add(testOneButton);
      column1.add(testTwoButton);
      if(Ti.Platform.osname != 'mobileweb'){
      	column1.add(testThreeButton);
      }
       
      column2.add(testFourButton);
      column2.add(testFiveButton);
      column2.add(testSixButton);
       
      column3.add(testSevenButton);
      column3.add(testEightButton);
      if(Ti.Platform.osname != 'mobileweb'){
      	column3.add(testNineButton);
      }
      if(Ti.Platform.osname != 'mobileweb'){ label.text = Ti.Analytics.lastEvent; }
      label.add(border);
      win.add(column1);
      win.add(column2);
      win.add(column3);
      win.add(label);
      win.open();
      

      To reproduce

      1. Modify tiapp.xml and change analytics to false
      2. Recompile the application and install to device
      3. Tail the analytics server
      4. Launch the application
      5. Click featureEvent and navEvent

      Actual result

      crash

      [ERROR] The application has crashed with an uncaught exception 'apsanalytics.exception.notenabled'.
      	Reason:
      	APSAnalytics has not been enabled. Call `enableWithAppKey:andDeployType:` to enable service.
      

      Expected result

      Should not see any analytics sent

        Attachments

          Activity

            People

            • Assignee:
              srahim Sabil Rahim
              Reporter:
              oromero Olga Romero
              Reviewer:
              Pedro Enrique (Inactive)
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-18878
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration