[TIMOB-23679] Hyperloop-examples: GLCalendarView delegate crashes on iOS device
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-04-22T11:14:19.000+0000 |
Affected Version/s | Release 5.4.0 |
Fix Version/s | Hyperloop 2.1.0 |
Components | Hyperloop, iOS |
Labels | hyperloop-examples |
Reporter | Andrew McElroy |
Assignee | Jan Vennemann |
Created | 2016-07-24T23:35:10.000+0000 |
Updated | 2017-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.
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
to apply the protocol correctly. Let me check the example tomorrow, but I'm pretty sure it's an implementation issue, no Hyperloop issue
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.The issue is still valid. When running on Simulator, all delegates are generated to the custom.m.ejs template correctly:
When we run on device, the header and implementation is written but empty:
Note: The signature on Simulator still looks invalid, because the
BOOL
type gets converted tochar
, 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/):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?
[~jvennemann] Could this be resolved with the 2.0.1 fix in TIMOB-24198?
[~hansknoechel], hm not sure and i don't have a device here to test. Can you check with your device?
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
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
andaddMethod
can't process the minified code properly. It recognizes thedefineClass
but can't assign theaddMethod
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.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.
PR (master): https://github.com/appcelerator/hyperloop.next/pull/141 PR (2_0_X): https://github.com/appcelerator/hyperloop.next/pull/142
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.