Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1518] iOS8: Quickly delete list view items can lead to crash

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-09-24T02:16:32.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
LabelsTCSupportTriage, core, ios, supportTeam
ReporterDavid He
AssigneeMauro Parra-Miranda
Created2014-07-04T03:49:27.000+0000
Updated2016-03-08T07:37:58.000+0000

Description

To produce the error - quickly delete line item one after another and eventually crash will happen
var win = Ti.UI.currentWindow;

var listView = Ti.UI.createListView();



var sections = [];
var fruitSection = Ti.UI.createListSection({
	headerTitle : 'Fruits'
});
var fruitDataSet = [{
	properties : {f
		title : 'Apple',
		canEdit : true
	}
}, {
	properties : {
		title : 'Banana',
		canEdit : true
	}
}, {
	properties : {
		title : 'Pineapple',
		canEdit : true
	}
}, {
	properties : {
		title : 'Kiwi Fruit',
		canEdit : true
	}
}, {
	properties : {
		title : 'Coconut',
		canEdit : true
	}
}, {
	properties : {
		title : 'Strawberry',
		canEdit : true
	}
}, {
	properties : {
		title : 'Watermelon',
		canEdit : true
	}
},{
	properties : {
		title : 'Mangosteen',
		canEdit : true
	}
},{
	properties : {
		title : 'Lychee',
		canEdit : true
	}
},{
	properties : {
		title : 'Dragonfruit',
		canEdit : true
	}
},{
	properties : {
		title : 'Mandrain',
		canEdit : true
	}
},{
	properties : {
		title : 'Orange',
		canEdit : true
	}
},{
	properties : {
		title : 'Guava',
		canEdit : true
	}
}];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);


listView.sections = sections;
win.add(listView);


 
[ERROR] :  The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] :  Reason:
[ERROR] :  *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]
[ERROR] :  Stack trace:
[ERROR] :  0   CoreFoundation                      0x04a6c5c8 __exceptionPreprocess + 152
[ERROR] :  1   libobjc.A.dylib                     0x03e018b6 objc_exception_throw + 44
[ERROR] :  2   CoreFoundation                      0x04a20316 -[__NSPlaceholderArray initWithObjects:count:] + 390
[ERROR] :  3   CoreFoundation                      0x04a43ce9 +[NSArray arrayWithObject:] + 73
[ERROR] :  4   testDavid                           0x002b7036 -[TiUIListView tableView:commitEditingStyle:forRowAtIndexPath:] + 2166
[ERROR] :  5   UIKit                               0x00904ba3 -[UITableView animateDeletionOfRowWithCell:] + 107
[ERROR] :  6   UIKit                               0x00a84695 -[UITableViewCell _swipeDeleteButtonPushed] + 70
[ERROR] :  7   libobjc.A.dylib                     0x03e13874 -[NSObject performSelector:withObject:withObject:] + 77
[ERROR] :  8   UIKit                               0x008160c2 -[UIApplication sendAction:to:from:forEvent:] + 108
[ERROR] :  9   UIKit                               0x0081604e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
[ERROR] :  10  UIKit                               0x0090e0c1 -[UIControl sendAction:to:forEvent:] + 66
[ERROR] :  11  UIKit                               0x0090e484 -[UIControl _sendActionsForEvents:withEvent:] + 577
[ERROR] :  12  UIKit                               0x0090d733 -[UIControl touchesEnded:withEvent:] + 641
[ERROR] :  13  UIKit                               0x00b88c7f _UIGestureRecognizerUpdate + 7166
[ERROR] :  14  UIKit                               0x0085319a -[UIWindow _sendGesturesForEvent:] + 1291
[ERROR] :  15  UIKit                               0x008540ba -[UIWindow sendEvent:] + 1030
[ERROR] :  16  UIKit                               0x00827e86 -[UIApplication sendEvent:] + 242
[ERROR] :  17  UIKit                               0x0081218f _UIApplicationHandleEventQueue + 11421
[ERROR] :  18  CoreFoundation                      0x049f583f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
[ERROR] :  19  CoreFoundation                      0x049f51cb __CFRunLoopDoSources0 + 235
[ERROR] :  20  CoreFoundation                      0x04a1229e __CFRunLoopRun + 910
[ERROR] :  21  CoreFoundation                      0x04a11ac3 CFRunLoopRunSpecific + 467
[ERROR] :  22  CoreFoundation                      0x04a118db CFRunLoopRunInMode + 123
[ERROR] :  23  GraphicsServices                    0x049c89e2 GSEventRunModal + 192
[ERROR] :  24  GraphicsServices                    0x049c8809 GSEventRun + 104
[ERROR] :  25  UIKit                               0x00814d3b UIApplicationMain + 1225
[ERROR] :  26  testDavid                           0x00006008 main + 456
[ERROR] :  27  libdyld.dylib                       0x076c0725 start + 0
[ERROR] :  2014-07-04 13:45:24.065 testDavid[43584:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 
'*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
[ERROR] :  *** First throw call stack:
[ERROR] :  (
[ERROR] :  	0   CoreFoundation                      0x04a6c5e4 __exceptionPreprocess + 180
[ERROR] :  	1   libobjc.A.dylib                     0x03e018b6 objc_exception_throw + 44
[ERROR] :  	2   CoreFoundation                      0x04a20316 -[__NSPlaceholderArray initWithObjects:count:] + 390
[ERROR] :  	3   CoreFoundation                      0x04a43ce9 +[NSArray arrayWithObject:] + 73
[ERROR] :  	4   testDavid                           0x002b7036 -[TiUIListView tableView:commitEditingStyle:forRowAtIndexPath:] + 2166
[ERROR] :  	5   UIKit                               0x00904ba3 -[UITableView animateDeletionOfRowWithCell:] + 107
[ERROR] :  	6   UIKit                               0x00a84695 -[UITableViewCell _swipeDeleteButtonPushed] + 70
[ERROR] :  	7   libobjc.A.dylib                     0x03e13874 -[NSObject performSelector:withObject:withObject:] + 77
[ERROR] :  	8   UIKit                               0x008160c2 -[UIApplication sendAction:to:from:forEvent:] + 108
[ERROR] :  	9   UIKit                               0x0081604e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
[ERROR] :  	10  UIKit                               0x0090e0c1 -[UIControl sendAction:to:forEvent:] + 66
[ERROR] :  	11  UIKit                               0x0090e484 -[UIControl _sendActionsForEvents:withEvent:] + 577
[ERROR] :  	12  UIKit                               0x0090d733 -[UIControl touchesEnded:withEvent:] + 641
[ERROR] :  	13  UIKit                               0x00b88c7f _UIGestureRecognizerUpdate + 7166
[ERROR] :  	14  UIKit                               0x0085319a -[UIWindow _sendGesturesForEvent:] + 1291
[ERROR] :  	15  UIKit                               0x008540ba -[UIWindow sendEvent:] + 1030
[ERROR] :  	16  UIKit                               0x00827e86 -[UIApplication sendEvent:] + 242
[ERROR] :  	17  UIKit                               0x0081218f _UIApplicationHandleEventQueue + 11421
[ERROR] :  	18  CoreFoundation                      0x049f583f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
[ERROR] :  	19  CoreFoundation                      0x049f51cb __CFRunLoopDoSources0 + 235
[ERROR] :  	20  CoreFoundation                      0x04a1229e __CFRunLoopRun + 910
[ERROR] :  	21  CoreFoundation                      0x04a11ac3 CFRunLoopRunSpecific + 467
[ERROR] :  	22  CoreFoundation                      0x04a118db CFRunLoopRunInMode + 123
[ERROR] :  	23  GraphicsServices                    0x049c89e2 GSEventRunModal + 192
[ERROR] :  	24  GraphicsServices                    0x049c8809 GSEventRun + 104
[ERROR] :  	25  UIKit                               0x00814d3b UIApplicationMain + 1225
[ERROR] :  	26  testDavid                           0x00006008 main + 456
[ERROR] :  	27  libdyld.dylib                       0x076c0725 start + 0
[ERROR] :  )
[ERROR] :  libc++abi.dylib: terminating with uncaught exception of type NSException
-- End simulator log ---------------------------------------------------------
[INFO] :   Application has exited from iOS Simulator
[INFO] :   Project built successfully in 56s 437ms

Comments

  1. David He 2014-07-04

    This is a serious problem prevents me from submitting my app!!! Please treat it urgently and get it fixed ASAP. Thanks
  2. Shuo Liang 2014-07-07

    Hi, Can you tell me which kind of device do you use, as I tried your code with different simulators. But can't reproduce your problem. Does this error happen when you run your simple test case or you have other code in your test case. On the other hand, would you please try to clean project, then run your app again. See if the problem still is there. Regards, Shuo
  3. David He 2014-07-07

    Hi Shuo Tried on iOS simulator 7.1. Try as quickly as possible to delete the line item - I can recreate this issue consistently, Code snippet is fairly enough for issue reproduction. Will try to clean the project and get back to you later Thanks
  4. Motiur Rahman 2014-08-03

    Hello, We tested this issue. We cannot reproduce this bug in latest Ti Tools.

    Testing Environment:

    Titanium SDK: 3.3.0.GA, Titanium CLI: 3.3.0, IOS Simulator: 7.1, OS X Version: 10.9.3, Appcelerator Studio: 3.3.0

    Steps to Test:

    1. Create a Classic project. 2. Paste this code in app.js file. 3. Run this code with the testing environment.
       function getInsertDataIOS(insertCount, sectionIndex, itemIndex, message, animation) {
       	var data = [{
       		properties : {
       			itemId : message
       		},
       		template : 'myCell',
       		mainLabel : {
       			text : insertCount + ' Insert at ' + itemIndex + ' in Section ' + sectionIndex + ' Animation ' + animation
       		},
       		childLabel : {
       			text : 'Insert ' + message
       		}
       	}];
       	return data;
       }
       
       function getInsertDataAndroid(insertCount, sectionIndex, itemIndex, message) {
       	var data = [{
       		properties : {
       			itemId : message
       		},
       		template : 'myCell',
       		mainLabel : {
       			text : insertCount + ' Insert at ' + itemIndex + ' in Section ' + sectionIndex
       		},
       		childLabel : {
       			text : 'Insert ' + message
       		}
       	}];
       	return data;
       }
       
       function getData() {
       	var data = [{
       		properties : {
       			title : 'bad index=100. check parity',
       			itemId : '101',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Delete Two',
       			itemId : '2',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'I will go too',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Delete Two',
       			itemId : '2',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'I will go too',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Delete Me',
       			itemId : '1',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Delete Me',
       			itemId : '1',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Delete Two',
       			itemId : '2',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'I will go too',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Delete Me',
       			itemId : '1',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Delete Me',
       			itemId : '1',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Delete Me',
       			itemId : '1',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'excesive count=100. check parity',
       			itemId : '100',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}, {
       		properties : {
       			title : 'Item',
       			height : 44
       		}
       	}];
       
       	return data;
       }
       
       	var win = Ti.UI.createWindow({
       		title : 'Delete Items'
       	});
       
       	var platformName = Titanium.Platform.osname;
       	var isIOS = (platformName == 'iphone' || platformName == 'ipad');
       
       	var section1 = Ti.UI.createListSection({
       		headerTitle : 'SECTION ONE'
       	});
       	section1.setItems(getData())
       	var listView = Ti.UI.createListView({
       		sections : [section1],
       	});
       
       	win.add(listView);
       	var counter1 = 1;
       
       	listView.addEventListener('itemclick', function(e) {
       		if (e.itemId !== undefined && e.itemId !== null) {
       			var deleteCount = parseInt(e.itemId);
       			var pos = e.itemIndex;
       			var theSection = e.section;
       			if (deleteCount == 101) {
       				pos = 1000;
       			}
       			if (isIOS) {
       				counter1 = counter1 % 6;
       				theSection.deleteItemsAt(pos, deleteCount);
       				counter1++;
       			} else {
       				theSection.deleteItemsAt(pos, deleteCount);
       			}
       		}
       	});
       
        win.open();
       
       
    Thanks
  5. David He 2014-08-10

    Probably it has been fixed in latest SDK 3.3.0 Please close it. Thanks
  6. Ed 2014-09-18

    I am seeing this issue now consistently with all my editable ListViews, after upgrading my iPhone to iOS 8 today. It happens when I swipe to reveal the Delete button, then tap somewhere on the list, or swipe back to hide it. Xcode device console logs hundreds of these warnings when it happens and then crashes the app: {quote} : reloading table view while we're in swipe to delete mode but we don't have a proper swipe to delete index path {quote} I'm running iOS 8 (device), with Ti SDK 3.3.0. I had seen this issue occasionally with iOS 7.1.2, but it was rather rare and you had to swipe really fast. With iOS 8, it happens all the time. I have not upgraded to Xcode 6 and iOS Simulator 8 yet, so I don't know if it can be reproduce there yet. Is anyone else experiencing this as well?
  7. David He 2014-09-18

    Ed How did you test it? Use my code above? Please refer to Shuo to reopen this ticket. Thanks
  8. Mauro Parra-Miranda 2014-09-24

    Tested with latest 3.4.0.RC, working fine.

JSON Source