Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27049] iOS: Simulator can crash because of the "trackUserInteraction" feature

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2019-06-04T22:31:49.000+0000
Affected Version/sRelease 8.0.0, Release 7.5.0, Release 8.1.0
Fix Version/sRelease 8.1.0
ComponentsiOS
Labelsn/a
ReporterHans Knöchel
AssigneeJan Vennemann
Created2019-05-01T13:19:28.000+0000
Updated2019-06-04T22:31:49.000+0000

Description

In TIMOB-26294, the Ti.App.trackUserInteraction property and userinteraction event have been added. On iOS, this can lead to crashes because other receivers of the UIApplicationDelegate method sendEvent: can influence the way this method behaves because the super call is before the override-implementation. Quote Apple: {quote} If you require it, you can intercept incoming events by subclassing UIApplication and overriding this method. For every event you intercept, you must dispatch it by calling \[super sendEvent:event\] after handling the event in your implementation. {quote} So the fix is to simply move the super-call after the implementation. The Crashlytics stack-trace to prove this crash:
com.apple.main-thread
0  QuartzCore                     0x108be3fbf classDescription(objc_class*) + 16
1  QuartzCore                     0x108be53d8 CAObject_defaultValueForAtom + 28
2  QuartzCore                     0x108b77f03 CA::Layer::default_value(unsigned int, _CAValueType, void*) + 125
3  QuartzCore                     0x108b76fea CA::Layer::getter(unsigned int, _CAValueType, void*) + 106
4  QuartzCore                     0x108b84ae7 ___ZL36cons_CALayer_kCAValueAssignedPointerjb_block_invoke + 57
5  UIKitCore                      0x1180e6967 _UIViewLayerGetView + 40
6  UIKitCore                      0x1180d87ec __scrollViewAncestorOfView + 105
7  UIKitCore                      0x118054ead -[UIScrollView setBounds:] + 537
8  UIKitCore                      0x117e327aa -[UITableView setBounds:] + 234
9  UIKitCore                      0x118056333 -[UIScrollView setContentOffset:] + 509
10 UIKitCore                      0x117e33b58 -[UITableView setContentOffset:] + 311
11 UIKitCore                      0x11805bdf1 -[UIScrollView _updatePanGesture] + 2464
12 UIKitCore                      0x1177f914d -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57
13 UIKitCore                      0x117801c69 _UIGestureRecognizerSendTargetActions + 109
14 UIKitCore                      0x1177ff5ba _UIGestureRecognizerSendActions + 311
15 UIKitCore                      0x1177fe897 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 966
16 UIKitCore                      0x1177f0c4e _UIGestureEnvironmentUpdate + 2820
17 UIKitCore                      0x1177f0108 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 478
18 UIKitCore                      0x1177efe96 -[UIGestureEnvironment _updateForEvent:window:] + 200
19 UIKitCore                      0x117c4b5bc -[UIWindow sendEvent:] + 4057
20 UIKitCore                      0x117c29d16 -[UIApplication sendEvent:] + 356
21 MyApp                          0x1045eef14 -[TiUIApplication sendEvent:] (TiUIApplication.m:18)
22 UIKitCore                      0x117cfa293 __dispatchPreprocessedEventFromEventQueue + 3232
23 UIKitCore                      0x117cfcbb9 __handleEventQueueInternal + 5911
24 CoreFoundation                 0x10ede5be1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
25 CoreFoundation                 0x10ede5463 __CFRunLoopDoSources0 + 243
26 CoreFoundation                 0x10eddfb1f __CFRunLoopRun + 1231
27 CoreFoundation                 0x10eddf302 CFRunLoopRunSpecific + 626
28 GraphicsServices               0x11368d2fe GSEventRunModal + 65
29 UIKitCore                      0x117c0fba2 UIApplicationMain + 140
30 MyApp                          0x104577902 main (main.m:66)
31 libdyld.dylib                  0x1109ad541 start + 1

Comments

  1. Hans Knöchel 2019-05-01

    Pull: https://github.com/appcelerator/titanium_mobile/pull/10872
  2. Jan Vennemann 2019-05-08

    [~hknoechel] are there any reproducible testing steps you could provide?
  3. Rene Pot 2019-05-29

  4. Keerthi Mahalingam 2019-06-03

    Verified sdk 8.1.0.v20190603131253 and master8.2.0.v20190603133455. Simulator is not crashed on maximizing and minimizing multiple times. *Test Environment:*
       Operating System
         Name                        = Mac OS X
         Version                     = 10.13.6
         Memory                      = 17179869184
       Node.js
         Node.js Version             = 8.9.1
         npm Version                 = 5.5.1
       Titanium CLI
         CLI Version                 = 5.1.1
       Titanium SDK
         SDK Version                 = 8.1.0.v20190603131253 and 8.2.0.v20190603133455
       Cli = 7.0.11
       Studio =5.1.2.201903111843
       Device = iPhone 6s plus iOS 12
       Simulator =iPhone 6 plus iOS 11,Iphone XR iOS 12 
       

JSON Source