Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3042] iOS: Picker Column removeRow Throws Unexpected Argument Exception

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionDuplicate
Resolution Date2011-10-27T18:30:18.000+0000
Affected Version/sRelease 1.5.1, Release 1.6.0
Fix Version/sBacklog
ComponentsiOS
Labelsdefect, ios, reported-1.5.1, reported-1.6.0, rplist
ReporterDawson Toth
AssigneeBlain Hamon
Created2011-04-15T03:35:22.000+0000
Updated2017-03-03T06:28:30.000+0000

Description

Problem

Calling removeRow on a picker column throws an Unexpected Argument Exception.

Sample Code

The following code shows a picker. If you tap on the non-selected row, removeRow will be called on the first row in the picker.

var win = Ti.UI.createWindow({ backgroundColor: '#fff' });

var picker = Titanium.UI.createPicker();
var rows = [
    Titanium.UI.createPickerRow({title:'Bananas'}),
    Titanium.UI.createPickerRow({title:'Strawberries'}),
    Titanium.UI.createPickerRow({title:'Mangos'}),
    Titanium.UI.createPickerRow({title:'Grapes'})
];
picker.add(rows);
picker.addEventListener('change', function(evt) {
    var column = picker.getColumns()[0];
    column.removeRow(column.rowAt(0));
});

win.add(picker);
win.open();

Exception

[ERROR] Invalid type passed to function. expected: NSNull, was: TiUIPickerRowProxy in -[TiUIPickerColumnProxy removeRow:] (TiUIPickerColumnProxy.m:57)
[ERROR] The application has crashed with an unhandled exception. Stack trace:
0 CoreFoundation 0x02254bcc __exceptionPreprocess + 156
1 libobjc.A.dylib 0x023a95c2 objc_exception_throw + 47
2 Playground2 0x0009c1a4 -[TiProxy throwException:subreason:location:] + 478
3 Playground2 0x00115067 -[TiUIPickerColumnProxy removeRow:] + 514
4 CoreFoundation 0x021c567d __invoking___ + 29
5 CoreFoundation 0x021c5551 -[NSInvocation invoke] + 145
6 Playground2 0x00039321 -[KrollMethod call:] + 2092
7 Playground2 0x000386d3 KrollCallAsFunction + 327
8 Playground2 0x0028b058 _ZN2TI16TiCallbackObjectINS_8TiObjectEE4callEPNS_10TiExcStateEPS1_NS_7TiValueERKNS_7ArgListE + 552
9 Playground2 0x0024ef28 cti_op_call_NotTiFunction + 632
10 ??? 0x0b0f2aa3 0x0 + 185543331
11 Playground2 0x001fe69b _ZN2TI11Interpreter7executeEPNS_18FunctionExecutableEPNS_10TiExcStateEPNS_10TiFunctionEPNS_8TiObjectERKNS_7ArgListEPNS_14ScopeChainNodeEPNS_7TiValueE + 971
12 Playground2 0x0026a8ff _ZN2TI10TiFunction4callEPNS_10TiExcStateENS_7TiValueERKNS_7ArgListE + 127
13 Playground2 0x001ae529 _ZN2TI4callEPNS_10TiExcStateENS_7TiValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE + 57
14 Playground2 0x002873d4 TiObjectCallAsFunction + 612
15 Playground2 0x0003317e -[KrollCallback call:thisObject:] + 784
16 Playground2 0x00034395 -[KrollEvent invoke:] + 92
17 Playground2 0x00033a26 -[KrollContext invoke:] + 43
18 Playground2 0x00035243 -[KrollContext main] + 3216
19 Foundation 0x005eed4c -[NSThread main] + 81
20 Foundation 0x005eecd8 __NSThread__main__ + 1387
21 libSystem.B.dylib 0x97f7e85d _pthread_start + 345
22 libSystem.B.dylib 0x97f7e6e2 thread_start + 34
2011-02-03 12:10:00.806 Playground2[65343:6003] *** Terminating app due to uncaught exception 'org.playground2.TiUIPickerColumnProxy', reason: 'Invalid type passed to function. expected: NSNull, was: TiUIPickerRowProxy in -[TiUIPickerColumnProxy removeRow:] (TiUIPickerColumnProxy.m:57)'
*** Call stack at first throw:
(
0 CoreFoundation 0x02254be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x023a95c2 objc_exception_throw + 47
2 Playground2 0x0009c1a4 -[TiProxy throwException:subreason:location:] + 478
3 Playground2 0x00115067 -[TiUIPickerColumnProxy removeRow:] + 514
4 CoreFoundation 0x021c567d __invoking___ + 29
5 CoreFoundation 0x021c5551 -[NSInvocation invoke] + 145
6 Playground2 0x00039321 -[KrollMethod call:] + 2092
7 Playground2 0x000386d3 KrollCallAsFunction + 327
8 Playground2 0x0028b058 _ZN2TI16TiCallbackObjectINS_8TiObjectEE4callEPNS_10TiExcStateEPS1_NS_7TiValueERKNS_7ArgListE + 552
9 Playground2 0x0024ef28 cti_op_call_NotTiFunction + 632
10 ??? 0x0b0f2aa3 0x0 + 185543331
11 Playground2 0x001fe69b _ZN2TI11Interpreter7executeEPNS_18FunctionExecutableEPNS_10TiExcStateEPNS_10TiFunctionEPNS_8TiObjectERKNS_7ArgListEPNS_14ScopeChainNodeEPNS_7TiValueE + 971
12 Playground2 0x0026a8ff _ZN2TI10TiFunction4callEPNS_10TiExcStateENS_7TiValueERKNS_7ArgListE + 127
13 Playground2 0x001ae529 _ZN2TI4callEPNS_10TiExcStateENS_7TiValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE + 57
14 Playground2 0x002873d4 TiObjectCallAsFunction + 612
15 Playground2 0x0003317e -[KrollCallback call:thisObject:] + 784
16 Playground2 0x00034395 -[KrollEvent invoke:] + 92
17 Playground2 0x00033a26 -[KrollContext invoke:] + 43
18 Playground2 0x00035243 -[KrollContext main] + 3216
19 Foundation 0x005eed4c -[NSThread main] + 81
20 Foundation 0x005eecd8 __NSThread__main__ + 1387
21 libSystem.B.dylib 0x97f7e85d _pthread_start + 345
22 libSystem.B.dylib 0x97f7e6e2 thread_start + 34
)
terminate called after throwing an instance of 'NSException'
[DEBUG] Session did end with error (null)
[INFO] Application has exited from Simulator

Tested On

Titanium SDK version: 1.6.0 (02/02/11 15:22 a02f7db...), also 1.5.1
BROKEN on iPhone Simulator 4.2

Associated Helpdesk Ticket

http://developer.appcelerator.com/helpdesk/view/69891">http://developer.appcelerator.com/helpdesk/view/69891

Comments

  1. Blain Hamon 2011-10-27

    This is because of NSInvocation.
  2. Lee Morris 2017-03-03

    Closing issue due to time passed and irrelevance of the ticket.

JSON Source