Problem description
Calling two or more Ti.Analytics.featureEvent in a short period of time causes the app to crash.
Steps to reproduce
Use the following code to test the problem:
var win = Ti.UI.createWindow({
title: "Crash Events",
barColor: "#ff00ff",
backgroundColor: "#ffffff"
}), subcatTable = Ti.UI.createTableView({
width: Ti.UI.FILL,
height: Ti.UI.FILL
});
var onItemClick = function (evt, featureName) {
Ti.Analytics.featureEvent(featureName, {
device: Ti.Platform.username,
time: (new Date()).getTime(),
env: "env name",
sessionID: "qwe123"
});
};
subcatTable.addEventListener('click', function(e) {
// detail click can all be handled in super.
//if (_my && _my.onItemClick) {
// we would like to know it was a doc detail list click, otherwise the detail win handles meta detail track.
//_my.onItemClick.call(null, event, EventManager.VIEW_ALLDOCS_DETAIL_EVENT);
onItemClick(e, "FEATURE_EVENT_CRASH1");
//}
Ti.Analytics.featureEvent("FEATURE_EVENT_CRASH2", {
device: Ti.Platform.username,
time: (new Date()).getTime(),
env: "env name",
sessionID: "qwe123"
});
//Ti.API.info("Clicked, wait for crash");
});
subcatTable.data = [
Ti.UI.createTableViewRow({
title: "a"
})
];
win.add(subcatTable);
win.open();
- Run the app
- Click on the table row: the app crashes
Note
Sometimes, the app does not crash the first time, but clicking 2-3 times on the row will do that. I've tested with SDK 2.1.2.GA and the app crashes without any error in the console. Opening the app with XCode, however, shows this error: EXC_BAD_ACCESS
I also tried testing with SDK 3.0.0.v20121002161335 and I see the following error in the Titanium console:
{color:red}
[ERROR] A SQLite database error occurred on database '/Users/dcassenti/Library/Application Support/iPhone Simulator/6.0/Applications/C6577659-96DC-4234-9051-2FE866115B98/Library/Application Support/analytics/analytics.db': Error Domain=com.plausiblelabs.pldatabase Code=3 "An error occured parsing the provided SQL statement." UserInfo=0xb216820 {com.plausiblelabs.pldatabase.error.vendor.code=1, NSLocalizedDescription=An error occured parsing the provided SQL statement., com.plausiblelabs.pldatabase.error.query.string=INSERT INTO pending_events VALUES (?), com.plausiblelabs.pldatabase.error.vendor.string=table pending_events has 1 columns but 2 values were supplied} (SQLite #1: table pending_events has 1 columns but 2 values were supplied) (query: 'INSERT INTO pending_events VALUES (?)')
{color}
Pull pending https://github.com/appcelerator/titanium_mobile/pull/3102
Pull merged
Tested with 3.0.0.v20121130200208 on iPad 4 6.0.1
Reopening to update labels
Was accidentally reopened.