Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13142] iOS: ListView, setting the layout property of the ItemTemplate causes the application to crash

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2013-03-21T18:30:14.000+0000
Affected Version/sRelease 3.1.0
Fix Version/sn/a
Componentsn/a
Labelstriage
ReporterBenjamin Hatfield
AssigneeMax Stepanov
Created2013-03-20T21:59:18.000+0000
Updated2017-03-22T18:34:01.000+0000

Description

REPRODUCTION: Run the code below on the iOS Simulator. RESULTS: The application crashes. NOTES: Code runs OK on the Android emulator (version 4.2). If you remove the properties property from the template, the application runs OK on the iOS simulator. TEST CODE:
var win = Ti.UI.createWindow({backgroundColor: 'white'});

var myTemplate = {
    childTemplates: [
        {                            
            type: 'Ti.UI.ImageView', 
            bindId: 'pic',
            properties: {  
                width: '50dp', height: '50dp', left: 0
            }
        },
        {      
            type: 'Ti.UI.Label',  
            bindId: 'info', 
            properties: { 
                color: 'black',
                font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' },
            }
        },
        { 
            type: 'Ti.UI.Label',
            bindId: 'es_info',
            properties: {
                color: 'gray',
                font: { fontFamily:'Arial', fontSize: '14dp' },
                left: '10dp'
            }
        }
    ],
    properties: {layout: 'horizontal'}
};

var listView = Ti.UI.createListView({
    templates: { 'template': myTemplate },
    defaultItemTemplate: 'template'
});
var sections = [];

var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits / Frutas'});
var fruitDataSet = [
    { info: {text: 'Apple'}, es_info: {text: 'Manzana'}, pic: {image: 'KS_nav_views.png'}},
    { info: {text: 'Banana'}, es_info: {text: 'Banana'}, pic: {image: 'KS_nav_views.png'}}
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);

var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables / Verduras'});
var vegDataSet = [
    { info: {text: 'Carrot'}, es_info: {text: 'Zanahoria'}, pic: {image: 'KS_nav_views.png'}},
    { info: {text: 'Potato'}, es_info: {text: 'Patata'}, pic: {image: 'KS_nav_views.png'}}
];
vegSection.setItems(vegDataSet);
sections.push(vegSection);

var grainSection = Ti.UI.createListSection({ headerTitle: 'Grains / Granos'});
var grainDataSet = [
    { info: {text: 'Corn'}, es_info: {text: 'Maiz'}, pic: {image: 'KS_nav_views.png'}},
    { info: {text: 'Rice'}, es_info: {text: 'Arroz'}, pic: {image: 'KS_nav_views.png'}}
];
grainSection.setItems(grainDataSet);
sections.push(grainSection);

listView.setSections(sections);
win.add(listView);
win.open();
SIMULATOR LOG: monospaced [ERROR] :  The application has crashed with an uncaught exception 'NSInvalidArgumentException'. [INFO] :   TestListView/1.0 (3.1.0.v20130319225749.29a41bf) [ERROR] :  Reason: [ERROR] :  -[UITableViewCellContentView fillBoundsToRect:]: unrecognized selector sent to instance 0xcc0b670 [ERROR] :  Stack trace: [ERROR] :  0 CoreFoundation 0x038ec012 __exceptionPreprocess + 178 [ERROR] :  1 libobjc.A.dylib 0x033ade7e objc_exception_throw + 44 [ERROR] :  2 CoreFoundation 0x039774bd -[NSObject(NSObject) doesNotRecognizeSelector:] + 253 [ERROR] :  3 CoreFoundation 0x038dbbbc ___forwarding___ + 588 [ERROR] :  4 CoreFoundation 0x038db94e _CF_forwarding_prep_0 + 14 [ERROR] :  5 libobjc.A.dylib 0x033c16b0 -[NSObject performSelector:withObject:] + 70 [ERROR] :  6 TestListView 0x00079c68 -[TiViewProxy makeViewPerformSelector:withObject:createIfNeeded:waitUntilDone:] + 200 [ERROR] :  7 TestListView 0x00071158 -[TiViewProxy size] + 184 [ERROR] :  8 TestListView 0x0015f605 SizeConstraintViewWithSizeAddingResizing + 277 [ERROR] :  9 TestListView 0x0007ce22 -[TiViewProxy relayout] + 610 [ERROR] :  10 TestListView 0x00081058 -[TiViewProxy layoutChild:optimize:withMeasuredBounds:] + 1736 [ERROR] :  11 TestListView 0x00081340 -[TiViewProxy layoutChildren:] + 656 [ERROR] :  12 TestListView 0x0028ccfa -[TiUIListItem layoutSubviews] + 138 [ERROR] :  13 UIKit 0x011fa2dd -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279 [ERROR] :  14 libobjc.A.dylib 0x033c16b0 -[NSObject performSelector:withObject:] + 70 [ERROR] :  15 QuartzCore 0x02769fc0 -[CALayer layoutSublayers] + 240 [ERROR] :  16 QuartzCore 0x0275e33c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468 [ERROR] :  17 QuartzCore 0x0275e150 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26 [ERROR] :  18 QuartzCore 0x026dc0bc _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 324 [ERROR] :  19 QuartzCore 0x026dd227 _ZN2CA11Transaction6commitEv + 395 [ERROR] :  20 QuartzCore 0x0277fb50 +[CATransaction flush] + 52 [ERROR] :  21 UIKit 0x011bfedf _afterCACommitHandler + 132 [ERROR] :  22 CoreFoundation 0x038b4afe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 [ERROR] :  23 CoreFoundation 0x038b4a3d __CFRunLoopDoObservers + 381 [ERROR] :  24 CoreFoundation 0x038927c2 __CFRunLoopRun + 1106 [ERROR] :  25 CoreFoundation 0x03891f44 CFRunLoopRunSpecific + 276 [ERROR] :  26 CoreFoundation 0x03891e1b CFRunLoopRunInMode + 123 [ERROR] :  27 GraphicsServices 0x036737e3 GSEventRunModal + 88 [ERROR] :  28 GraphicsServices 0x03673668 GSEventRun + 104 [ERROR] :  29 UIKit 0x011a9ffc UIApplicationMain + 1211 [ERROR] :  30 TestListView 0x00004488 main + 456 [ERROR] :  31 TestListView 0x00002d95 start + 53 [ERROR] :  2013-03-20 14:52:44.587 TestListView[64139:1c103] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCellContentView fillBoundsToRect:]: unrecognized selector sent to instance 0xcc0b670' [ERROR] :  *** First throw call stack: [ERROR] :  (0x38ec012 0x33ade7e 0x39774bd 0x38dbbbc 0x38db94e 0x33c16b0 0x79c68 0x71158 0x15f605 0x7ce22 0x81058 0x81340 0x28ccfa 0x11fa2dd 0x33c16b0 0x2769fc0 0x275e33c 0x275e150 0x26dc0bc 0x26dd227 0x277fb50 0x11bfedf 0x38b4afe 0x38b4a3d 0x38927c2 0x3891f44 0x3891e1b 0x36737e3 0x3673668 0x11a9ffc 0x4488 0x2d95) -- End simulator log --------------------------------------------------------- [ERROR] :  An error occurred running the iOS Simulator [ERROR] :   [ERROR] :  Project failed to build after 14s 273ms monospaced

Comments

  1. Ingo Muschenetz 2013-03-21

    Layout property is not supported on ItemTemplate.
  2. Max Stepanov 2013-03-21

    PR https://github.com/appcelerator/titanium_mobile/pull/4004

JSON Source