[TIMOB-17195] Analytics: iOS - The application has crashed with an uncaught exception 'apsanalytics.exception.notenabled'
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-06-23T23:13:08.000+0000 |
Affected Version/s | Release 3.3.0 |
Fix Version/s | Release 3.3.0, Release 3.4.0 |
Components | iOS |
Labels | analytics, module_analytics, qe-3.3.0, qe-testadded |
Reporter | Olga Romero |
Assignee | Sabil Rahim |
Created | 2014-06-23T22:12:03.000+0000 |
Updated | 2014-07-28T20:54:14.000+0000 |
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 navEventActual 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 sentAttachments
File | Date | Size |
---|---|---|
analytics_ios_crash.txt | 2014-06-23T22:12:03.000+0000 | 24493 |
FYI
master : https://github.com/appcelerator/titanium_mobile/pull/5839 3_3_X : https://github.com/appcelerator/titanium_mobile/pull/5840
Tested and verified the fix with: Mac osx 10.9.3 Mavericks Appcelerator Studio, build: 3.3.0.201406231625 Titanium SDK, build: 3.3.0.v20140623161712 Node.JS Version: v0.10.13 NPM Version: 1.3.2 acs@1.0.14 alloy@1.4.0-rc2 npm@1.3.2 titanium@3.3.0-rc2 titanium-code-processor@1.1.1 Device: iPhone5C iOS 7.1 No crash.