Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16594] iOS: Editable ListView with RefreshControl + tintColor crashes swipe-delete event.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2014-03-17T19:59:05.000+0000
Affected Version/sn/a
Fix Version/s2014 Sprint 06, 2014 Sprint 06 SDK, Release 3.2.3, Release 3.3.0
ComponentsiOS
Labelscrash, delete, event, ios, listview, qe-closed-3.2.3, qe-testadded, tintColor
ReporterEd
AssigneeVishal Duggal
Created2014-03-06T04:39:34.000+0000
Updated2014-03-18T21:08:48.000+0000

Description

An editable ListView with a RefreshControl crashes if tintColor is defined for the RefreshControl AND one tries to JSON.stringify() the delete event object. Expected behavior: JSON.strigify(e) should work on the delete event, regardless of the RefreshControl and its tintColor property. Test with code below. Swipe delete one row and the following error gets logged: bq. alloyblank[56590:320b] -[UIDeviceRGBColor boundBridge:withKrollObject:]: unrecognized selector sent to instance 0xcc53e30 Swipe delete another one, and the app crashes with: bq. [ valueForUndefinedKey:]: this class is not key value coding-compliant for the key toJSON.
<Alloy>
	<Window class="container">
		<ListView id="lv" onDelete="lv_delete">
			<ListSection id="ls" />
		</ListView>
	</Window>
</Alloy>
var refresh = Ti.UI.createRefreshControl({ 
    // DEFINING THIS WILL CRASH DELETE EVENT
    tintColor: '#ff0000'
});


$.lv.applyProperties({
    refreshControl: refresh
});


var rows = [];
for (var i = 0; i < 50; i++) {
    rows.push({ properties: { title: 'Row '+ i, canEdit: true }});
}


$.ls.setItems(rows);


$.index.open();


function lv_delete(e) {
    Ti.API.info('this works: ' + e.itemIndex); 

    // JSON.stringify(e) WILL CRASH IF tintColor IS DEFINED ABOVE
    Ti.API.info('stringify: ' + JSON.stringify(e)); 
}

Comments

  1. Vishal Duggal 2014-03-07

    Classic test code
       var win = Ti.UI.createWindow({backgroundColor:'white',fullscreen:true})
       
       var refresh = Ti.UI.createRefreshControl({ 
           // DEFINING THIS WILL CRASH DELETE EVENT
           tintColor: '#ff0000'
       });
       
       
       var listView = Ti.UI.createListView({refreshControl: refresh});
       
       var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'}); 
        
        
       var rows = [];
       for (var i = 0; i < 50; i++) {
           rows.push({ properties: { title: 'Row '+ i, canEdit: true }});
       }
        
        
       fruitSection.setItems(rows);
       
       listView.setSections([fruitSection]);
       
       win.add(listView);
        
        
       win.open();
        
        
       function lv_delete(e) {
           Ti.API.info('this works: ' + e.itemIndex); 
        
           // JSON.stringify(e) WILL CRASH IF tintColor IS DEFINED ABOVE
           Ti.API.info('stringify: ' + JSON.stringify(e)); 
       }
       
       
       listView.addEventListener('delete',lv_delete);
       
  2. Vishal Duggal 2014-03-07

    Pull pending master - https://github.com/appcelerator/titanium_mobile/pull/5442 3_2_X - https://github.com/appcelerator/titanium_mobile/pull/5482
  3. Olga Romero 2014-03-18

    Tested and verified the fix with: Appcelerator Studio, build: 3.2.3.201403171239 Titanium SDK, build: 3.2.3.v20140317142455 Node.JS Version: v0.10.13 NPM Version: 1.3.2 ├── acs@1.0.14 ├── alloy@1.3.1 ├── npm@1.3.2 ├── titanium@3.2.1 └── titanium-code-processor@1.1.0

JSON Source