Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23679] Hyperloop-examples: GLCalendarView delegate crashes on iOS device

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-04-22T11:14:19.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sHyperloop 2.1.0
ComponentsHyperloop, iOS
Labelshyperloop-examples
ReporterAndrew McElroy
AssigneeJan Vennemann
Created2016-07-24T23:35:10.000+0000
Updated2017-04-24T05:31:35.000+0000

Description

When I attempt to run https://github.com/appcelerator/hyperloop-examples on my iPhone and navigate to the Calendar example. The moment I touch an actual calendar day, the app crashes. I am able to scroll through the calendar, but I am unable to select dates. Here is the stacktrace I get: -- Start application log ----------------------------------------------------- [INFO] Hyperloop_Sample/1.0 (5.4.0.f343fcd) [ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'. [ERROR] Reason: [ERROR] -[CalendarDelegate calenderView:canAddRangeWithBeginDate:]: unrecognized selector sent to instance 0x1375d03c0 [ERROR] Stack trace: [ERROR] [ERROR] 0 CoreFoundation 0x0000000183ab6db0 + 124 [ERROR] 1 libobjc.A.dylib 0x000000018311bf80 objc_exception_throw + 56 [ERROR] 2 CoreFoundation 0x0000000183abdc4c + 0 [ERROR] 3 CoreFoundation 0x0000000183ababec + 872 [ERROR] 4 CoreFoundation 0x00000001839b8c5c _CF_forwarding_prep_0 + 92 [ERROR] 5 Hyperloop_Sample 0x000000010026edac Hyperloop_Sample + 1732012 [ERROR] 6 UIKit 0x0000000188e4e414 + 608 [ERROR] 7 UIKit 0x0000000188e4dd58 + 540 [ERROR] 8 UIKit 0x0000000188dbb458 + 336 [ERROR] 9 UIKit 0x0000000188e090f8 + 60 [ERROR] 10 UIKit 0x0000000188dbb458 + 336 [ERROR] 11 UIKit 0x0000000188e090f8 + 60 [ERROR] 12 UIKit 0x0000000188dbb458 + 336 [ERROR] 13 UIKit 0x0000000188e090f8 + 60 [ERROR] 14 UIKit 0x0000000188c04c0c + 8988 [ERROR] 15 UIKit 0x0000000188c45610 + 1132 [ERROR] 16 UIKit 0x0000000188c44c0c + 764 [ERROR] 17 UIKit 0x0000000188c1504c + 248 [ERROR] 18 UIKit 0x0000000188c13628 + 6568 [ERROR] 19 CoreFoundation 0x0000000183a6d09c + 24 [ERROR] 20 CoreFoundation 0x0000000183a6cb30 + 540 [ERROR] 21 CoreFoundation 0x0000000183a6a830 + 724 [ERROR] 22 CoreFoundation 0x0000000183994c50 CFRunLoopRunSpecific + 384 [ERROR] 23 GraphicsServices 0x000000018527c088 GSEventRunModal + 180 [ERROR] 24 UIKit 0x0000000188c7e088 UIApplicationMain + 204 [ERROR] 25 Hyperloop_Sample 0x00000001000cd558 Hyperloop_Sample + 21848 [ERROR] 26 libdyld.dylib 0x00000001835328b8 + 4 [ERROR] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CalendarDelegate calenderView:canAddRangeWithBeginDate:]: unrecognized selector sent to instance 0x1375d03c0' [ERROR] *** First throw call stack: [ERROR] (0x183ab6db0 0x18311bf80 0x183abdc4c 0x183ababec 0x1839b8c5c 0x10026edac 0x188e4e414 0x188e4dd58 0x188dbb458 0x188e090f8 0x188dbb458 0x188e090f8 0x188dbb458 0x188e090f8 0x188c04c0c 0x188c45610 0x188c44c0c 0x188c1504c 0x188c13628 0x183a6d09c 0x183a6cb30 0x183a6a830 0x183994c50 0x18527c088 0x188c7e088 0x1000cd558 0x1835328b8) [ERROR] objc[3130]: Class URLSessionDelegate is implemented in both /usr/lib/libTelephonyUtilDynamic.dylib and /var/containers/Bundle/Application/8C1ABCA9-D87E-439F-B076-ECBF4D2DA0C8/Hyperloop_Sample.app/Hyperloop_Sample. One of the two will be used. Which one is undefined. [INFO] Hyperloop_Sample/1.0 (5.4.0.f343fcd) [ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'. [ERROR] Reason: [ERROR] -[CalendarDelegate calenderView:canAddRangeWithBeginDate:]: unrecognized selector sent to instance 0x144dae070 [ERROR] Stack trace: [ERROR] [ERROR] 0 CoreFoundation 0x0000000183ab6db0 + 124 [ERROR] 1 libobjc.A.dylib 0x000000018311bf80 objc_exception_throw + 56 [ERROR] 2 CoreFoundation 0x0000000183abdc4c + 0 [ERROR] 3 CoreFoundation 0x0000000183ababec + 872 [ERROR] 4 CoreFoundation 0x00000001839b8c5c _CF_forwarding_prep_0 + 92 [ERROR] 5 Hyperloop_Sample 0x000000010021edac Hyperloop_Sample + 1732012 [ERROR] 6 UIKit 0x0000000188e4e414 + 608 [ERROR] 7 UIKit 0x0000000188e4dd58 + 540 [ERROR] 8 UIKit 0x0000000188dbb458 + 336 [ERROR] 9 UIKit 0x0000000188e090f8 + 60 [ERROR] 10 UIKit 0x0000000188dbb458 + 336 [ERROR] 11 UIKit 0x0000000188e090f8 + 60 [ERROR] 12 UIKit 0x0000000188dbb458 + 336 [ERROR] 13 UIKit 0x0000000188e090f8 + 60 [ERROR] 14 UIKit 0x0000000188c4c084 + 804 [ERROR] 15 UIKit 0x0000000188c44c20 + 784 [ERROR] 16 UIKit 0x0000000188c1504c + 248 [ERROR] 17 UIKit 0x0000000188c13628 + 6568 [ERROR] 18 CoreFoundation 0x0000000183a6d09c + 24 [ERROR] 19 CoreFoundation 0x0000000183a6cb30 + 540 [ERROR] 20 CoreFoundation 0x0000000183a6a830 + 724 [ERROR] 21 CoreFoundation 0x0000000183994c50 CFRunLoopRunSpecific + 384 [ERROR] 22 GraphicsServices 0x000000018527c088 GSEventRunModal + 180 [ERROR] 23 UIKit 0x0000000188c7e088 UIApplicationMain + 204 [ERROR] 24 Hyperloop_Sample 0x000000010007d558 Hyperloop_Sample + 21848 [ERROR] 25 libdyld.dylib 0x00000001835328b8 + 4 [ERROR] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CalendarDelegate calenderView:canAddRangeWithBeginDate:]: unrecognized selector sent to instance 0x144dae070' [ERROR] *** First throw call stack: [ERROR] (0x183ab6db0 0x18311bf80 0x183abdc4c 0x183ababec 0x1839b8c5c 0x10021edac 0x188e4e414 0x188e4dd58 0x188dbb458 0x188e090f8 0x188dbb458 0x188e090f8 0x188dbb458 0x188e090f8 0x188c4c084 0x188c44c20 0x188c1504c 0x188c13628 0x183a6d09c 0x183a6cb30 0x183a6a830 0x183994c50 0x18527c088 0x188c7e088 0x10007d558 0x1835328b8) ^C% It is worth pointing out this example works on the Simulator. Also, the other examples do work on the device. It is this specific example which does not work.

Comments

  1. Hans Knöchel 2016-07-25

    I'm wondering how any of the delegates work in the simulator, since the delegate is [commented out](https://github.com/appcelerator/hyperloop-examples/blob/master/app/controllers/ios/libraries/calendar.js#L42). It needs to be
       var CalendarDelegate = Hyperloop.defineClass('CalendarDelegate', 'NSObject', ['GLCalendarViewDelegate']);
       
    to apply the protocol correctly. Let me check the example tomorrow, but I'm pretty sure it's an implementation issue, no Hyperloop issue
  2. Chee Kiat Ng 2016-08-02

    Here's my latest findings wrt this. If you build to simulator, the class delegates are correctly generated into custom.m but NOT the case when you build to device. Go to the generated Xcode project and open it. look for custom.m and search for CalendarDelegate. This is also the same when i apply the protocol correctly as shown but Hans.
  3. Hans Knöchel 2016-10-09

    The issue is still valid. When running on Simulator, all delegates are generated to the custom.m.ejs template correctly:
       @interface CalendarDelegate : NSObject <GLCalendarViewDelegate>
       
       -(char)calenderView:(GLCalendarView *)arg0 canAddRangeWithBeginDate:(NSDate *)arg1;
       
       -(GLCalendarDateRange *)calenderView:(GLCalendarView *)arg0 rangeToAddWithBeginDate:(NSDate *)arg1;
       
       -(void)calenderView:(GLCalendarView *)arg0 beginToEditRange:(NSDate *)arg1;
       
       -(void)calenderView:(GLCalendarView *)arg0 finishEditRange:(NSDate *)arg1 continueEditing:(char)arg2;
       
       -(char)calenderView:(GLCalendarView *)arg0 canUpdateRange:(GLCalendarDateRange *)arg1 toBeginDate:(NSDate *)arg2 endDate:(NSDate *)arg3;
       
       -(void)calenderView:(GLCalendarView *)arg0 didUpdateRange:(GLCalendarDateRange *)arg1 toBeginDate:(NSDate *)arg2 endDate:(NSDate *)arg3;
       
       @end
       
       @implementation CalendarDelegate
       // ...
       @end
       
    When we run on device, the header and implementation is written but empty:
       
       /**
        * user class defined at /Users/hknoechel/Documents/Apps/hyperloop-examples/build/iphone/assets/alloy/controllers/libraries/calendar_js:1
        */
       @interface CalendarDelegate : NSObject <GLCalendarViewDelegate>
       
       
       @end
       
       @implementation CalendarDelegate
       
       
       @end
       
    Note: The signature on Simulator still looks invalid, because the BOOL type gets converted to char, but it works. This happens [here](https://github.com/appcelerator/hyperloop.next/blob/master/metabase/ios/lib/generate/custom.js#L758-L760) and is explained [here](http://nshipster.com/bool/):
       		case 'BOOL':
       		case 'char': return 'c';
       		case 'bool': return 'B';
       
  4. Kevin Southworth 2017-01-10

    I'm having this exact same issue. The implementation of the delegate class is empty when building for device, which makes hyperloop kinda useless in this case. Is there a workaround to get the compiler to generate the implementation correctly?
  5. Hans Knöchel 2017-02-03

    [~jvennemann] Could this be resolved with the 2.0.1 fix in TIMOB-24198?
  6. Jan Vennemann 2017-02-07

    [~hansknoechel], hm not sure and i don't have a device here to test. Can you check with your device?
  7. Andrew McElroy 2017-02-13

    I am able to confirm that when I build from hyperloop master branch (2.1.0 module version) that this is still an issue on an iPhone 6 Plus running iOS 10.2.1 (14D27) It appears as though no third party modules are copying over. It applies to GLCalendarView ( or any other third party library) see this stack trace for Shimmer: [ERROR] Cannot find class with name: FBShimmeringView [ERROR] Script Error { [ERROR] column = 32; [ERROR] description = "Cannot find class with name: FBShimmeringView"; [ERROR] line = 106; [ERROR] message = "Cannot find class with name: FBShimmeringView"; [ERROR] name = ClassNotFound; [ERROR] nativeStack = "1 libobjc.A.dylib 0x0000000183e0055c objc_exception_throw + 56\n2 Hyperloop_Sample 0x0000000100356280 Hyperloop_Sample + 2794112\n3 Hyperloop_Sample 0x000000010034f3c8 Hyperloop_Sample + 2765768\n4 JavaScriptCore 0x00000001898f2380 + 416\n5 JavaScriptCore 0x000000018930d830 + 480\n6 JavaScriptCore 0x00000001899f463c + 24876\n7 JavaScriptCore 0x00000001899f464c + 24892\n8 JavaScriptCore 0x00000001899f49e4 + 25812\n9 JavaScriptCore 0x00000001899f464c + 24892\n10 JavaScriptCore 0x00000001899f49e4 + 25812\n11 JavaScriptCore 0x00000001899f45e8 + 24792\n12 JavaScriptCore 0x00000001899ee348 + 264\n13 JavaScriptCore 0x00000001898c0a8c + 168\n14 JavaScriptCore 0x00000001893118e8 + 352\n15 JavaScriptCore 0x0000000189584a1c _ZN3JSC12profiledCallEPNS_9ExecStateENS_15ProfilingReasonENS_7JSValueENS_8CallTypeERKNS_8CallDataES3_RKNS_7ArgListE + 160\n16 JavaScriptCore 0x000000018931169c JSObjectCallAsFunction + 536\n17 Hyperloop_Sample 0x000000010021031c Hyperloop_Sample + 1458972\n18 Hyperloop_Sample 0x000000010015b96c Hyperloop_Sample + 719212\n19 Hyperloop_Sample 0x00000001002101e0 Hyperloop_Sample + 1458656\n20 Hyperloop_Sample 0x00000001002104f8 Hyperloop_Sample + 1459448\n21 Hyperloop_Sample 0x00000001000cc2a4 Hyperloop_Sample + 131748\n22 Hyperloop_Sample 0x00000001000cc3a0 Hyperloop_Sample + 132000\n23 Hyperloop_Sample 0x000000010015b96c Hyperloop_Sample + 719212\n24 Hyperloop_Sample 0x00000001000cc360 Hyperloop_Sample + 131936\n25 Hyperloop_Sample 0x000000010021057c Hyperloop_Sample + 1459580\n26 Hyperloop_Sample 0x000000010020fa94 Hyperloop_Sample + 1456788\n27 Hyperloop_Sample 0x00000001001399fc Hyperloop_Sample + 580092\n28 Hyperloop_Sample 0x00000001000eb914 Hyperloop_Sample + 260372\n29 Hyperloop_Sample 0x00000001001396a8 Hyperloop_Sample + 579240\n30 Hyperloop_Sample 0x000000010022be88 Hyperloop_Sample + 1572488\n31 Hyperloop_Sample 0x0000000100229a10 Hyperloop_Sample + 1563152\n32 UIKit 0x000000018b3ac484 + 1424\n33 UIKit 0x000000018b45cf34 + 268\n34 UIKit 0x000000018b50ffdc + 292\n35 UIKit 0x000000018b501d50 + 560\n36 UIKit 0x000000018b2710b4 + 168\n37 CoreFoundation 0x00000001853760c0 + 32\n38 CoreFoundation 0x0000000185373cf0 + 372\n39 CoreFoundation 0x0000000185374180 + 1024\n40 CoreFoundation 0x00000001852a22b8 CFRunLoopRunSpecific + 444\n41 GraphicsServices 0x0000000186d56198 GSEventRunModal + 180\n42 UIKit 0x000000018b2e97fc + 684\n43 UIKit 0x000000018b2e4534 UIApplicationMain + 208\n44 Hyperloop_Sample 0x00000001000b3980 Hyperloop_Sample + 31104\n45 libdyld.dylib 0x00000001842855b8 + 4"; [ERROR] sourceURL = "file:///var/containers/Bundle/Application/C3F82E08-11A1-46CA-86B7-C7E6154F9946/Hyperloop_Sample.app/hyperloop/shimmer/fbshimmeringview.js"; [ERROR] }
  8. Jan Vennemann 2017-02-21

    Quick update on this: After some debugging i was able to track this is down to the minification of JS files, which only happens during device builds. The logic that handles defineClass and addMethod can't process the minified code properly. It recognizes the defineClass but can't assign the addMethod call with that class, which is why the generated delegate class is empty. A simple workaround while we are working on a fix is to use the --skip-js-minify flag for device builds for now. [~sophrinix], Cannot find class with name: FBShimmeringView seems like a different issue, i'll look into that too.
  9. Hans Knöchel 2017-03-11

    The crash is fixed in https://github.com/appcelerator/hyperloop-examples/pull/53 (without Hyperloop update). This ticket we kept open to also allow classes to have delegates defined inline.
  10. Jan Vennemann 2017-04-04

    PR (master): https://github.com/appcelerator/hyperloop.next/pull/141 PR (2_0_X): https://github.com/appcelerator/hyperloop.next/pull/142
  11. Abir Mukherjee 2017-04-24

    Node Version: 6.10.1 NPM Version: 3.10.10 Mac OS: 10.12.4 Appc CLI: 6.2.0 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.0.3.GA Appcelerator Studio, build: 4.8.1.201612050850 Xcode 8.2.1 Hyperloop 2.1.0 commit *bc83fef Tested with the above environment, and no crash was seen. When a date was selected, the console correctly printed the date selected. When tapping the date again, I was able to change the date range. The console correctly printed the range selected.

JSON Source