amirrajan / rubymotion-applied

RubyMotion documentation provided by the community. Submit a pull request to the docs for a free one year indie subscription.
Apache License 2.0
49 stars 10 forks source link

Crashes inside third-party libraries on Mojave (e.g.: afmotion) #113

Open savytskyi opened 5 years ago

savytskyi commented 5 years ago

OS: Mojave Ruby version: 2.5.3 (however tested on 2.4.x and 2.3.7, same problem) RM: 5.15 beta 2 Example repo: https://github.com/savytskyi/rubymotion-bug

Problem: app compiles well, but started to crash in weird places when it never crashed before. For example, when using 3rd party libraries like AFMotion:


2018-10-31 12:53:09.854 debug[28317:1457952] /Users/ky/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/afmotion-2.6/lib/afmotion/http.rb:51:in `<: can't convert true into String (TypeError)
    from app/app_delegate.rb:13:in `application:didFinishLaunchingWithOptions:'
2018-10-31 12:53:09.855 debug[28317:1457952] /Users/ky/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/afmotion-2.6/lib/afmotion/http.rb:51:in `<: can't convert true into String (TypeError)
    from app/app_delegate.rb:13:in `application:didFinishLaunchingWithOptions:'
2018-10-31 12:53:09.901 debug[28317:1457952] *** Terminating app due to uncaught exception 'TypeError', reason: '/Users/ky/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/afmotion-2.6/lib/afmotion/http.rb:51:in `<: can't convert true into String (TypeError)
    from app/app_delegate.rb:13:in `application:didFinishLaunchingWithOptions:'
'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001023cb29b __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x0000000100dca735 objc_exception_throw + 48
    2   debug                               0x0000000100694650 _ZL10__vm_raisev + 336
    3   debug                               0x00000001006946e0 rb_vm_raise + 80
    4   debug                               0x000000010059ff39 rb_exc_raise + 9
    5   debug                               0x0000000100599ff3 rb_raise + 179
    6   debug                               0x00000001005d528d rb_objc_convert_type + 973
    7   debug                               0x0000000100620488 rb_string_value + 216
    8   debug                               0x0000000100620399 rb_string_value_cstr + 9
    9   debug                               0x000000010030a2d6 vm_rval_to_sel + 278
    10  debug                               0x0000000100310971 __unnamed_181 + 273
    11  debug                               0x000000010066e10d send_internal + 301
    12  debug                               0x000000010067a61e rb_vm_dispatch + 5278
    13  debug                               0x00000001002fe7d4 vm_dispatch + 1380
    14  debug                               0x0000000100301fed rb_scope10 + 781
    15  debug                               0x000000010067c382 _ZL13vm_block_evalP7RoxorVMP11rb_vm_blockP13objc_selectormiPKm + 1490
    16  debug                               0x00000001006911f5 rb_vm_block_method_imp + 501
    17  debug                               0x000000010067a61e rb_vm_dispatch + 5278
    18  debug                               0x0000000100567274 vm_dispatch + 1380
    19  debug                               0x0000000100569c25 rb_scope__application:didFinishLaunchingWithOptions:__ + 1637
    20  debug                               0x0000000100569d8d __unnamed_5 + 61
    21  UIKitCore                           0x000000011062d4d7 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280
    22  UIKitCore                           0x000000011062eec4 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3979
    23  UIKitCore                           0x0000000110634527 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1623
    24  UIKitCore                           0x0000000110ed6e3e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
    25  UIKitCore                           0x0000000110ed3403 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
    26  UIKitCore                           0x0000000110ed6a7b -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233
    27  UIKitCore                           0x0000000110ed7435 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085
    28  UIKitCore                           0x0000000110e94b31 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795
    29  UIKitCore                           0x0000000110e947db -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435
    30  UIKitCore                           0x0000000110ed992c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584
    31  UIKitCore                           0x0000000110eda256 _performActionsWithDelayForTransitionContext + 100
    32  UIKitCore                           0x0000000110ed968b -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221
    33  UIKitCore                           0x0000000110ed2aa1 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
    34  UIKitCore                           0x0000000110632d46 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
    35  UIKitCore                           0x0000000110664856 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357
    36  FrontBoardServices                  0x0000000109f2cdda -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
    37  FrontBoardServices                  0x0000000109f37f43 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271
    38  FrontBoardServices                  0x0000000109f3763a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
    39  libdispatch.dylib                   0x0000000104163587 _dispatch_client_callout + 8
    40  libdispatch.dylib                   0x0000000104166647 _dispatch_block_invoke_direct + 312
    41  FrontBoardServices                  0x0000000109f6c3c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
    42  FrontBoardServices                  0x0000000109f6c080 -[FBSSerialQueue _performNext] + 457
    43  FrontBoardServices                  0x0000000109f6c660 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    44  CoreFoundation                      0x000000010232eb31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    45  CoreFoundation                      0x000000010232e3a3 __CFRunLoopDoSources0 + 243
    46  CoreFoundation                      0x0000000102328a4f __CFRunLoopRun + 1263
    47  CoreFoundation                      0x0000000102328221 CFRunLoopRunSpecific + 625
    48  GraphicsServices                    0x000000010735f1dd GSEventRunModal + 62
    49  UIKitCore                           0x0000000110636115 UIApplicationMain + 140
    50  debug                               0x00000001000249d4 main + 148
    51  libdyld.dylib                       0x00000001041d3551 start + 1
    52  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type TypeError
amirrajan commented 5 years ago

Just to rule other things out. Can someone try Xcode 10.0 on High Sierra with RM 5.14 (last RM stable release)?

eamonn-webster commented 5 years ago

I downloaded the rubymotion-bug repo

macOS: 10.13.6 (17G3025) rubymotion: 5.14 Xcode: Version 10.0 (10A255)

Apart form having to add the following it all worked fine. app.info_plist['NSAppTransportSecurity'] = {'NSAllowsArbitraryLoads' => true}

I then tried rake clean:all and rake pod:install and it is still good.

as an aside, why do people include vendor/Pods in their repos?

wndxlori commented 5 years ago

I'm working off my own repo (I shared it with you Amir, swapi-potion). 5.14 works fine. 5.15 does not.

And I've even confirmed it's not something squirrelly with AFMotion gem itself. I removed that gem and just coded directly against the AFNetworking pod, and it works in 5.14 and fails in 5.15. Perhaps this is a CocoaPods problem?

Anyway, mine fails without a traceback, but I'm attaching the crashlog I got. Keeping in mind, this crashes when I run a command at the REPL that is making an HTTP request with AFNetworking (here is the branch/file https://github.com/wndxgroup/swapi-potion/blob/afmotion-crash-515/app/models/swapi_store.rb). crash.log

wndxlori commented 5 years ago

Here's a fork of @savytskyi's repo stripped down, and only using AFNetworking. Same. 5.14 works, 5.15 is busted. https://github.com/wndxlori/rubymotion-bug/tree/afnetworking-version

Oh, ya. High Sierra.

wndxlori commented 5 years ago

Just for laughs, I updated AFNetworking pod to latest, greatest version - 3.2. Same result.