Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20270] iOS: Uncaught exception NSInvalidArgumentException loading XIB file

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-12-13T09:57:23.000+0000
Affected Version/sn/a
Fix Version/sBacklog
ComponentsiOS
Labelsn/a
ReporterEduardo Gomez
AssigneeHans Knöchel
Created2016-01-25T18:46:11.000+0000
Updated2018-08-06T17:49:15.000+0000

Description

Issue Description

When creating an Appcelerator module the first XIB file was loaded. However, no tap/gesture were detected and we are unable to move/navigate to the next XIB file.

Steps to reproduce

1) iOS native project which has 2 XIB files. On clicking "Button" you will move to the next XIB page with text "Label" 2) Grab Appcelerator module 3) Test Project with first page from Appcelerator view having text "load XIB". On click it will load the first page of native XIB. On clicking "Button" it crashes. See please logs below.

Stack Trace

-- Start simulator log -------------------------------------------------------
[INFO]  Application started
[INFO]  XibSampleProject/1.0 (5.1.1.e46100b)
[INFO]  [object ComAccentureXibmodModule] loaded
[ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] Reason:
[ERROR] -[UIViewController buttonTapped:]: unrecognized selector sent to instance 0x7fb962c55320
[ERROR] Stack trace:
[ERROR]   
[ERROR] 0   CoreFoundation                      0x000000010fa4fe4d __exceptionPreprocess + 141
[ERROR] 1   libobjc.A.dylib                     0x000000010f421deb objc_exception_throw + 48
[ERROR] 2   CoreFoundation                      0x000000010fa5848d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
[ERROR] 3   CoreFoundation                      0x000000010f9a590a ___forwarding___ + 970
[ERROR] 4   CoreFoundation                      0x000000010f9a54b8 _CF_forwarding_prep_0 + 120
[ERROR] 5   UIKit                               0x000000010bf47194 -[UIApplication sendAction:to:from:forEvent:] + 92
[ERROR] 6   UIKit                               0x000000010c0b66fc -[UIControl sendAction:to:forEvent:] + 67
[ERROR] 7   UIKit                               0x000000010c0b69c8 -[UIControl _sendActionsForEvents:withEvent:] + 311
[ERROR] 8   UIKit                               0x000000010c0b5af8 -[UIControl touchesEnded:withEvent:] + 601
[ERROR] 9   UIKit                               0x000000010bfb649b -[UIWindow _sendTouchesForEvent:] + 835
[ERROR] 10  UIKit                               0x000000010bfb71d0 -[UIWindow sendEvent:] + 865
[ERROR] 11  UIKit                               0x000000010bf65b66 -[UIApplication sendEvent:] + 263
[ERROR] 12  UIKit                               0x000000010bf3fd97 _UIApplicationHandleEventQueue + 6844
[ERROR] 13  CoreFoundation                      0x000000010f97ba31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
[ERROR] 14  CoreFoundation                      0x000000010f97195c __CFRunLoopDoSources0 + 556
[ERROR] 15  CoreFoundation                      0x000000010f970e13 __CFRunLoopRun + 867
[ERROR] 16  CoreFoundation                      0x000000010f970828 CFRunLoopRunSpecific + 488
[ERROR] 17  GraphicsServices                    0x0000000110d97ad2 GSEventRunModal + 161
[ERROR] 18  UIKit                               0x000000010bf45610 UIApplicationMain + 171
[ERROR] 19  XibSampleProject                    0x000000010a0413e6 main + 310
[ERROR] 20  libdyld.dylib                       0x000000011069d92d start + 1
[ERROR]   
[ERROR] 2016-01-25 12:24:51.130 XibSampleProject[42557:4180970] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController buttonTapped:]: unrecognized selector sent to instance 0x7fb962c55320'
[ERROR] *** First throw call stack:
[ERROR] ( 
[ERROR]         0   CoreFoundation                      0x000000010fa4fe65 __exceptionPreprocess + 165
[ERROR]         1   libobjc.A.dylib                     0x000000010f421deb objc_exception_throw + 48
[ERROR]         2   CoreFoundation                      0x000000010fa5848d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
[ERROR]         3   CoreFoundation                      0x000000010f9a590a ___forwarding___ + 970
[ERROR]         4   CoreFoundation                      0x000000010f9a54b8 _CF_forwarding_prep_0 + 120
[ERROR]         5   UIKit                               0x000000010bf47194 -[UIApplication sendAction:to:from:forEvent:] + 92
[ERROR]         6   UIKit                               0x000000010c0b66fc -[UIControl sendAction:to:forEvent:] + 67
[ERROR]         7   UIKit                               0x000000010c0b69c8 -[UIControl _sendActionsForEvents:withEvent:] + 311
[ERROR]         8   UIKit                               0x000000010c0b5af8 -[UIControl touchesEnded:withEvent:] + 601
[ERROR]         9   UIKit                               0x000000010bfb649b -[UIWindow _sendTouchesForEvent:] + 835
[ERROR]         10  UIKit                               0x000000010bfb71d0 -[UIWindow sendEvent:] + 865
[ERROR]         11  UIKit                               0x000000010bf65b66 -[UIApplication sendEvent:] + 263
[ERROR]         12  UIKit                               0x000000010bf3fd97 _UIApplicationHandleEventQueue + 6844
[ERROR]         13  CoreFoundation                      0x000000010f97ba31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
[ERROR]         14  CoreFoundation                      0x000000010f97195c __CFRunLoopDoSources0 + 556
[ERROR]         15  CoreFoundation                      0x000000010f970e13 __CFRunLoopRun + 867
[ERROR]         16  CoreFoundation                      0x000000010f970828 CFRunLoopRunSpecific + 488
[ERROR]         17  GraphicsServices                    0x0000000110d97ad2 GSEventRunModal + 161
[ERROR]         18  UIKit                               0x000000010bf45610 UIApplicationMain + 171
[ERROR]         19  XibSampleProject                    0x000000010a0413e6 main + 310
[ERROR]         20  libdyld.dylib                       0x000000011069d92d start + 1
[ERROR] ) 
[ERROR] libc++abi.dylib: terminating with uncaught exception of type NSException

Attachments

FileDateSize
com.accenture.xibmod-iphone-1.0.zip2016-01-25T23:35:57.000+0000144081
Test_code.zip2016-01-25T18:44:55.000+00009496398

Comments

  1. Chee Kiat Ng 2016-01-27

    https://wiki.appcelerator.org/display/guides2/Module+Development+Tutorial+-+iOS See section about xib.
  2. Chee Kiat Ng 2016-02-22

    Hi, just curious, are you trying to create https://github.com/appcelerator-modules/ti.gigya
  3. sumit kothari 2016-02-29

    @Chee, nope we are not trying to create ti.gigya module. We just used that project as a reference, as mentioned in your earlier comment. What we are trying to achieve is handling the click events of buttons/views which are created in xib and have their event listener in their respective .h/.m file (within the module).
  4. Pedro Enrique 2016-03-08

    According to the crash log, you're trying to call - (IBAction)buttonTapped:(UIButton *)sender of a _UIViewController_, which it does not exists. Which means that you created a normal _UIViewController_ instead of the _RootViewController_. What I can see, from looking at the code and content of the XIB, is that you're creating a _UIViewController_ passing XIB file that does not contain a ViewController. It simply contains a _UIView_ (with subviews and so on)
  5. Hans Knöchel 2016-12-13

    XIB files can be loaded using Hyperloop these days. Example:
       var NSBundle = require('Foundation/NSBundle');
       var view = NSBundle.mainBundle.loadNibNamedOwnerOptions('view'); // will look for "view.xib"
       container.add(view.objectAtIndex(0));
       
    Thx!
  6. Eric Merriman 2018-08-06

    Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.

JSON Source