Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14510

iOS: touchstart or touchend event on a ListView template makes the app crash

    Details

      Description

      Problem

      The application crash after firing the touchstart or touchend event. The listener is called, but the app crashes right after. The crash only happens when the listener is set on a child template of a ListView (see test case below).

      Expected behavior: the touchstart and touchend events shouldn't crash the app when used with ListView's templates.

      Additional info: listeners for other events seems to works fine though (at least the click event does).

      Steps:

      1. Run the code below
      2. Click on the first or second row of the ListView
      3. The app crashes


      Test case

      (same thing happens with the touchend event)

      app.js

      function onTouchStart() {
      	Ti.API.info("touch start !");
      	// The app crashes after that
      }
       
      function onClick() {
      	Ti.API.info("click !");
      	// No crash
      }
       
      var viewTemplate = {
      	type : "Ti.UI.View",
      	events : {
      		touchstart : onTouchStart, // Comment this line to remove the listener and avoid the crash
      		//click: onClick // The click listener works fine. Comment the touchstart listener above first because it will be fired as well.
      	}
      };
       
      var template = {
      	childTemplates : [viewTemplate]
      }
       
      var section = Ti.UI.createListSection({
      	items : [{}, {}] // 2 empty rows for the purpose of this demo
      });
       
      var listView = Ti.UI.createListView({
      	templates : {
      		"default" : template
      	},
      	defaultItemTemplate : "default",
      	sections : [section]
      });
       
      var win = Ti.UI.createWindow();
      win.add(listView);
      win.open();
      

      Logs

      console

      Titanium Command-Line Interface, CLI version 3.1.1, Titanium SDK version 3.1.1.GA
      Copyright (c) 2012-2013, Appcelerator, Inc.  All Rights Reserved.
      Please report bugs to http://jira.appcelerator.org/
      [INFO] :   Deploy type: development
      [INFO] :   Building for target: simulator
      [INFO] :   Building using iOS SDK: 6.1
      [INFO] :   Building for iOS iPad Simulator: 6.1
      [INFO] :   Building for device family: ipad
      [INFO] :   Minimum iOS version: 5.0
      [INFO] :   Debugging disabled
      [INFO] :   Profiler disabled
      [INFO] :   Initiating prepare phase
      [INFO] :   No Titanium Modules required, continuing
      [INFO] :   Creating symlinks for simulator build
      [INFO] :   No module resources to copy
      [INFO] :   No CommonJS modules to copy
      [INFO] :   Skipping xcodebuild
      [INFO] :   Finished building the application in 767ms
      [INFO] :   Running application in iOS Simulator
      [INFO] :   Launching application in iOS Simulator
      [INFO] :   Focusing the iOS Simulator
      [INFO] :   Application started
      [INFO] :   Test/1.0 (3.1.1.GA.f7592c1)
      [INFO] :   touch start !
      [ERROR] :  The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
      [INFO] :   2013-07-10 13:35:39.135 Test[15499:1b503] -[UITableViewCellContentView handleControlEvents:]: unrecognized selector sent to instance 0xa85d730
      [ERROR] :  Reason:
      [ERROR] :  -[UITableViewCellContentView handleControlEvents:]: unrecognized selector sent to instance 0xa85d730
      [ERROR] :  Stack trace:
      [ERROR] :  0   CoreFoundation                      0x038ce012 __exceptionPreprocess + 178
      [ERROR] :  1   libobjc.A.dylib                     0x0338fe7e objc_exception_throw + 44
      [ERROR] :  2   CoreFoundation                      0x039594bd -[NSObject(NSObject) doesNotRecognizeSelector:] + 253
      [ERROR] :  3   CoreFoundation                      0x038bdbbc ___forwarding___ + 588
      [ERROR] :  4   CoreFoundation                      0x038bd94e _CF_forwarding_prep_0 + 14
      [ERROR] :  5   Test                                0x000a34c5 -[TiUIView handleControlEvents:] + 197
      [ERROR] :  6   Test                                0x000a3751 -[TiUIView processTouchesBegan:withEvent:] + 337
      [ERROR] :  7   Test                                0x000a35b9 -[TiUIView touchesBegan:withEvent:] + 185
      [ERROR] :  8   UIKit                               0x012311d3 _UIGestureRecognizerUpdate + 7407
      [ERROR] :  9   CoreFoundation                      0x03896afe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
      [ERROR] :  10  CoreFoundation                      0x03896a3d __CFRunLoopDoObservers + 381
      [ERROR] :  11  CoreFoundation                      0x038747c2 __CFRunLoopRun + 1106
      [ERROR] :  12  CoreFoundation                      0x03873f44 CFRunLoopRunSpecific + 276
      [ERROR] :  13  CoreFoundation                      0x03873e1b CFRunLoopRunInMode + 123
      [ERROR] :  14  GraphicsServices                    0x036557e3 GSEventRunModal + 88
      [ERROR] :  15  GraphicsServices                    0x03655668 GSEventRun + 104
      [ERROR] :  16  UIKit                               0x00f69ffc UIApplicationMain + 1211
      [ERROR] :  17  Test                                0x00007b98 main + 456
      [ERROR] :  18  Test                                0x00003365 start + 53
      [ERROR] :  2013-07-10 13:35:39.137 Test[15499:1b503] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCellContentView handleControlEvents:]: unrecognized selector sent to instance 0xa85d730'
      [ERROR] :  *** First throw call stack:
      [ERROR] :  (0x38ce012 0x338fe7e 0x39594bd 0x38bdbbc 0x38bd94e 0xa34c5 0xa3751 0xa35b9 0x12311d3 0x3896afe 0x3896a3d 0x38747c2 0x3873f44 0x3873e1b 0x36557e3 0x3655668 0xf69ffc 0x7b98 0x3365)
      -- End simulator log ---------------------------------------------------------
      [ERROR] :  An error occurred running the iOS Simulator
      [ERROR] :  
      [ERROR] :  Project failed to build after 9s 445ms
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vduggal Vishal Duggal (Inactive)
                Reporter:
                pdaigle Patrick Daigle
                Reviewer:
                Pedro Enrique (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-16954
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration