Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23130] iOS: TableViewRow.title crashes app if it is not set to a string

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-04-01T11:04:28.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsiOS
Labelsqe-5.4.0
ReporterFokke Zandbergen
AssigneeAngel Petkov
Created2016-03-31T19:24:01.000+0000
Updated2016-06-10T17:58:41.000+0000

Description

On iOS only (didn't test Windows, but Android works) the app will crash if you pass a number to TableViewRow.title. This is a problem because since ALOY-1355 [Alloy will convert](https://github.com/appcelerator/alloy/pull/756/files#diff-ace298e00a3d12d9898391056d0c0b47R228) a string true|false to boolean and valid integers and floats to number. So if in XML you have <TableViewRow title="1" /> it will become a number and crash. Unless we can resolve ALOY-1355 in a different way (as suggested: only cast if you leave away quotes around the attribute) easily/soon, we should probably just make sure TableViewRow.title can work with boolean and number values as well. *app.js*
var win = Ti.UI.createWindow();
win.add(Ti.UI.createTableView({
  top: 20,
  data: [{
    title: 1         // crashes
    // title: true      crashes
    // title: '1'       works
  }]
}));
win.open();
*console*
[DEBUG] 2016-03-31 21:15:16.508 numtitle[78308:2391163] -[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xb000000000000015
[ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] Reason:
[ERROR] -[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xb000000000000015
[ERROR] Stack trace:
[ERROR]
[ERROR] 0   CoreFoundation                      0x000000010afbcd6d __exceptionPreprocess + 141
[ERROR] 1   libobjc.A.dylib                     0x000000010a98adeb objc_exception_throw + 48
[ERROR] 2   CoreFoundation                      0x000000010afc5d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
[ERROR] 3   CoreFoundation                      0x000000010af0bcfa ___forwarding___ + 970
[ERROR] 4   CoreFoundation                      0x000000010af0b8a8 _CF_forwarding_prep_0 + 120
[ERROR] 5   UIKit                               0x00000001073f6df1 -[UITableViewLabel setText:] + 119
[ERROR] 6   numtitle                            0x00000001051aa45e -[TiUITableViewRowProxy configureTitle:] + 110
[ERROR] 7   numtitle                            0x00000001051ad06a -[TiUITableViewRowProxy initializeTableViewCell:] + 122
[ERROR] 8   numtitle                            0x00000001050fc062 -[TiUITableView tableView:cellForRowAtIndexPath:] + 482
[ERROR] 9   UIKit                               0x00000001070ac4f4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 766
[ERROR] 10  UIKit                               0x00000001070ac62c -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
[ERROR] 11  UIKit                               0x0000000107080d4f -[UITableView _updateVisibleCellsNow:isRecursive:] + 2996
[ERROR] 12  UIKit                               0x00000001070b5686 -[UITableView _performWithCachedTraitCollection:] + 92
[ERROR] 13  UIKit                               0x000000010709c344 -[UITableView layoutSubviews] + 224
[ERROR] 14  UIKit                               0x0000000107009980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
[ERROR] 15  QuartzCore                          0x0000000109a02c00 -[CALayer layoutSublayers] + 146
[ERROR] 16  QuartzCore                          0x00000001099f708e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
[ERROR] 17  QuartzCore                          0x00000001099f6f0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
[ERROR] 18  QuartzCore                          0x00000001099eb3c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
[ERROR] 19  QuartzCore                          0x0000000109a19086 _ZN2CA11Transaction6commitEv + 486
[ERROR] 20  QuartzCore                          0x0000000109a197f8 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
[ERROR] 21  CoreFoundation                      0x000000010aee1c37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
[ERROR] 22  CoreFoundation                      0x000000010aee1ba7 __CFRunLoopDoObservers + 391
[ERROR] 23  CoreFoundation                      0x000000010aed77fb __CFRunLoopRun + 1147
[ERROR] 24  CoreFoundation                      0x000000010aed70f8 CFRunLoopRunSpecific + 488
[ERROR] 25  GraphicsServices                    0x000000010cad1ad2 GSEventRunModal + 161
[ERROR] 26  UIKit                               0x0000000106f4ef09 UIApplicationMain + 171
[ERROR] 27  numtitle                            0x0000000105053fc6 main + 310
[ERROR] 28  libdyld.dylib                       0x000000010c3d592d start + 1
[ERROR]
[ERROR] 2016-03-31 21:15:16.528 numtitle[78308:2391163] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xb000000000000015'
[ERROR] *** First throw call stack:
[ERROR] (
[ERROR]         0   CoreFoundation                      0x000000010afbcd85 __exceptionPreprocess + 165
[ERROR]         1   libobjc.A.dylib                     0x000000010a98adeb objc_exception_throw + 48
[ERROR]         2   CoreFoundation                      0x000000010afc5d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
[ERROR]         3   CoreFoundation                      0x000000010af0bcfa ___forwarding___ + 970
[ERROR]         4   CoreFoundation                      0x000000010af0b8a8 _CF_forwarding_prep_0 + 120
[ERROR]         5   UIKit                               0x00000001073f6df1 -[UITableViewLabel setText:] + 119
[ERROR]         6   numtitle                            0x00000001051aa45e -[TiUITableViewRowProxy configureTitle:] + 110
[ERROR]         7   numtitle                            0x00000001051ad06a -[TiUITableViewRowProxy initializeTableViewCell:] + 122
[ERROR]         8   numtitle                            0x00000001050fc062 -[TiUITableView tableView:cellForRowAtIndexPath:] + 482
[ERROR]         9   UIKit                               0x00000001070ac4f4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 766
[ERROR]         10  UIKit                               0x00000001070ac62c -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
[ERROR]         11  UIKit                               0x0000000107080d4f -[UITableView _updateVisibleCellsNow:isRecursive:] + 2996
[ERROR]         12  UIKit                               0x00000001070b5686 -[UITableView _performWithCachedTraitCollection:] + 92
[ERROR]         13  UIKit                               0x000000010709c344 -[UITableView layoutSubviews] + 224
[ERROR]         14  UIKit                               0x0000000107009980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
[ERROR]         15  QuartzCore                          0x0000000109a02c00 -[CALayer layoutSublayers] + 146
[ERROR]         16  QuartzCore                          0x00000001099f708e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
[ERROR]         17  QuartzCore                          0x00000001099f6f0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
[ERROR]         18  QuartzCore                          0x00000001099eb3c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
[ERROR]         19  QuartzCore                          0x0000000109a19086 _ZN2CA11Transaction6commitEv + 486
[ERROR]         20  QuartzCore                          0x0000000109a197f8 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
[ERROR]         21  CoreFoundation                      0x000000010aee1c37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
[ERROR]         22  CoreFoundation                      0x000000010aee1ba7 __CFRunLoopDoObservers + 391
[ERROR]         23  CoreFoundation                      0x000000010aed77fb __CFRunLoopRun + 1147
[ERROR]         24  CoreFoundation                      0x000000010aed70f8 CFRunLoopRunSpecific + 488
[ERROR]         25  GraphicsServices                    0x000000010cad1ad2 GSEventRunModal + 161
[ERROR]         26  UIKit                               0x0000000106f4ef09 UIApplicationMain + 171
[ERROR]         27  numtitle                            0x0000000105053fc6 main + 310
[ERROR]         28  libdyld.dylib                       0x000000010c3d592d start + 1
[ERROR] )
[ERROR] libc++abi.dylib: terminating with uncaught exception of type NSException
[TRACE] [numtitle] -[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xb000000000000015
[TRACE] [numtitle] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xb000000000000015'

Comments

  1. Fokke Zandbergen 2016-03-31

    /cc [~cbarber] since you implemented ALOY-1355
  2. Chris Barber 2016-03-31

    Ah, our first edge case.
  3. Angel Petkov 2016-03-31

    PR pending : https://github.com/appcelerator/titanium_mobile/pull/7902
  4. Be Rushton 2016-04-12

    This also happens on PickerRow's
  5. Chee Kiat Ng 2016-04-12

    [~bearus] Can you create a separate ticket for that issue please?
  6. Angel Petkov 2016-04-12

  7. Be Rushton 2016-04-13

    I'll workaround it until 5.4 is released. Thanks.
  8. Josh Longton 2016-06-10

    Verified as fixed. 
Tested on:
 iPhone 6s Plus (9.3.1) iOS Simulator (9.3) 
Mac OSX El Capitan 10.11.4 Studio: 4.7.0.201606070951
 Ti SDK: 5.4.0.v20160608165242
 Appc NPM: 4.2.7-2 Appc CLI: 5.4.0-13 
Xcode 7.3 Node v0.12.7
 *Closing Ticket.*

JSON Source