Show exception while click on RPSystemBroadcastPickerView

485 views Asked by At

While clicking on RPSystemBroadcastPickerView's subview button, a controller may present. but t is giving an exception with the following description:-

Fatal Exception: NSInvalidArgumentException Application tried to present modally an active controller

Crashlytics Logs:-

1  libobjc.A.dylib                0x1acb54c1c objc_exception_throw
2  UIKitCore                      0x1b092fb20 -[UIViewController _presentViewController:withAnimationController:completion:]
3  UIKitCore                      0x1b0931e00 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke
4  UIKitCore                      0x1b0932354 -[UIViewController _performCoordinatedPresentOrDismiss:animated:]
5  UIKitCore                      0x1b0931d4c -[UIViewController _presentViewController:animated:completion:]
6  UIKitCore                      0x1b0931fe0 -[UIViewController presentViewController:animated:completion:]
7  ReplayKit                      0x1d7cab6f8 -[RPModalPresentationWindow presentViewController:animated:completion:]
8  ReplayKit                      0x1d7c9ba98 -[RPBroadcastPickerStandaloneViewController presentAnimated:completion:]
9  ReplayKit                      0x1d7c9c54c __45-[RPSystemBroadcastPickerView buttonPressed:]_block_invoke
10 ReplayKit                      0x1d7c9b8d4 __120-[RPBroadcastPickerStandaloneViewController loadViewControllerWithBundleIdentifier:showMicrophoneButton:withCompletion:]_block_invoke_2
11 libdispatch.dylib              0x1acadeec4 _dispatch_call_block_and_release
12 libdispatch.dylib              0x1acae033c _dispatch_client_callout
13 libdispatch.dylib              0x1acaec600 _dispatch_main_queue_callback_4CF
14 CoreFoundation                 0x1acdbb41c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
15 CoreFoundation                 0x1acdb6034 __CFRunLoopRun
16 CoreFoundation                 0x1acdb5660 CFRunLoopRunSpecific
17 GraphicsServices               0x1b71c6604 GSEventRunModal
18 UIKitCore                      0x1b0f8a15c UIApplicationMain
19 ScreenRecorder                 0x10055d068 main + 30 (AppDelegate.swift:30)
20 libdyld.dylib                  0x1acc311ec start
1

There are 1 answers

0
林东鹏 On

It's a bug in ios13.0. While presentingVC, ReplayKit use UIApplicationRotationFollowingController(modalTransitionStyle = pageSheet) to present a RPBroadcastPickerStandaloneViewController(modalTransitionStyle = curl). But curl is only available while the previous vc is fullScreen. So the solution is to hook presentApi and change the style.