4 Replies
      Latest reply on Mar 21, 2019 3:37 PM by ThreeTwoOffset
      bws2007 Level 1 Level 1 (0 points)

        Hi,

         

        I am using RPSystemBroadcastPickerView to enable the user start broadcast in simpler way.

        I've created new iOS "Single View App" project, added the code to ViewController class:

        override func viewDidLoad() {
                super.viewDidLoad()
                // Do any additional setup after loading the view, typically from a nib.
                let screenSharingProviderPickerView: RPSystemBroadcastPickerView = RPSystemBroadcastPickerView(frame: view.frame)
               
                view.addSubview(screenSharingProviderPickerView)//append(screenSharingProviderPickerView)//insertSubview(screenSharingProviderPickerView, at: 0)
                screenSharingProviderPickerView.translatesAutoresizingMaskIntoConstraints = false
               
                NSLayoutConstraint.activate([screenSharingProviderPickerView.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: 0),
                                             screenSharingProviderPickerView.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 0),
                                             screenSharingProviderPickerView.widthAnchor.constraint(equalToConstant: 100),
                                             screenSharingProviderPickerView.heightAnchor.constraint(equalToConstant: 100)])
        
            }

        Build and run project on a device, tap to white-black circle in the middle of the screen, BroadcastPickerView appears, but at the same time I've got error message to the console:
        Unbalanced calls to begin/end appearance transitions for <UIApplicationRotationFollowingController: 0x109301750>.   

        In new empty project it is working for the end user, BroadcastPickerView is always presented on the screen without any defects.

        But when i try to use the same code in larger project, UI begins not responsive for 6-7 seconds (UI elements doesnt recieve any touch events) after i tap to RPSystemBroadcastPickerView.

         

        Are there any workarounds for this "Unbalanced call" error?

         

        Thank you in advance.

        • Re: Error by RPSystemBroadcastPickerView "Unbalanced calls to begin/end appearance transitions"
          Jilai Yuan Level 1 Level 1 (0 points)

          I also came up with the same issue. When RPSystemBroadcastPickerView added to mine custom view, sometimes UI elements doesn't receive any touch event. If you go to Xcode10.1 ->Windows -> Devices and Simulators -> View Device Logs, you will find RPBroadcastPicker crash. So I think this is a bug for iOS 12. Because of the RPBroadcastPicker crashed, custom UI elements cannot receive touch events.

           

          Here is the crash log.

           

          Incident Identifier: 7C73A8D2-7467-4068-AAAA-4173ED622588
          CrashReporter Key:   e57b950542ec8dad4d194500b57c5cb165dbc8ff
          Hardware Model:      iPhone10,2
          Process:             RPBroadcastPicker [2519]
          Path:                /System/Library/Frameworks/ReplayKit.framework/PlugIns/RPBroadcastPicker.appex/RPBroadcastPicker
          Identifier:          com.apple.ReplayKit.RPBroadcastPicker
          Version:             1 (1.0)
          Code Type:           ARM-64 (Native)
          Role:                Foreground
          Parent Process:      launchd [1]
          Coalition:           com.apple.ReplayKit.RPBroadcastPicker [3074]
          
          
          
          
          Date/Time:           2018-12-04 15:24:23.9833 +0800
          Launch Time:         2018-12-04 15:24:23.8574 +0800
          OS Version:          iPhone OS 12.1 (16B92)
          Baseband Version:    3.11.00
          Report Version:      104
          
          
          Exception Type:  EXC_CRASH (SIGABRT)
          Exception Codes: 0x0000000000000000, 0x0000000000000000
          Exception Note:  EXC_CORPSE_NOTIFY
          Triggered by Thread:  0
          
          
          Application Specific Information:
          abort() called
          
          
          Last Exception Backtrace:
          0   CoreFoundation                 0x196fdfea0 __exceptionPreprocess + 228
          1   libobjc.A.dylib               0x1961b1a40 objc_exception_throw + 55
          2   CoreFoundation                 0x196ef8d04 -[NSObject+ 216324 (NSObject) doesNotRecognizeSelector:] + 139
          3   CoreFoundation                 0x196fe57b8 ___forwarding___ + 1411
          4   CoreFoundation                 0x196fe745c _CF_forwarding_prep_0 + 91
          5   TextInput                     0x19f0b2824 TIGetHardwareLayoutsForInputMode + 183
          6   UIKitCore                     0x1c3ed9d4c UIKeyboardGetSupportedHardwareKeyboardsForInputMode + 43
          7   UIKitCore                     0x1c3ed6c08 UIKeyboardGetDefaultHardwareKeyboardForInputMode + 39
          8   UIKitCore                     0x1c3ed69e8 UIKeyboardInputModeGetIdentifierWithKeyboardLayouts + 131
          9   UIKitCore                     0x1c3ed36c4 +[UIKeyboardInputMode hardwareLayoutFromIdentifier:] + 59
          10  UIKitCore                     0x1c3ed3834 -[UIKeyboardInputMode initWithIdentifier:] + 319
          11  UIKitCore                     0x1c3ed3b50 +[UIKeyboardInputMode keyboardInputModeWithIdentifier:] + 267
          12  UIKitCore                     0x1c3febac4 -[UIInputWindowController updateSupportsDockViewController] + 71
          13  UIKitCore                     0x1c3fdd7ac -[UIInputWindowController initWithNibName:bundle:] + 347
          14  UIKitCore                     0x1c44bb9b4 -[UITextEffectsWindow+ 12331444 (UIObjectsForPerScreen) _initWithScreen:options:] + 563
          15  UIKitCore                     0x1c4567f84 +[_UIObjectPerScreen objectOfClass:forScreen:withOptions:createIfNecessary:] + 635
          16  UIKitCore                     0x1c44bd2fc +[UITextEffectsWindow _sharedTextEffectsWindowforScreen:aboveStatusBar:allowHosted:matchesStatusBarOrientationOnAccess:shouldCreateIfNecessary:] + 635
          17  UIKitCore                     0x1c44bd47c +[UITextEffectsWindow sharedTextEffectsWindowForScreen:] + 159
          18  UIKitCore                     0x1c458edc4 -[_UIViewServiceTextEffectsOperator __createHostedTextEffectsWithReplyHandler:] + 271
          19  CoreFoundation                 0x196fe7600 __invoking___ + 143
          20  CoreFoundation                 0x196ec5530 -[NSInvocation invoke] + 291
          21  CoreFoundation                 0x196ec6114 -[NSInvocation invokeWithTarget:] + 59
          22  UIKitCore                     0x1c45a2550 -[_UIViewServiceImplicitAnimationDecodingProxy forwardInvocation:] + 103
          23  CoreFoundation                 0x196fe54b4 ___forwarding___ + 639
          24  CoreFoundation                 0x196fe745c _CF_forwarding_prep_0 + 91
          25  CoreFoundation                 0x196fe7600 __invoking___ + 143
          26  CoreFoundation                 0x196ec5530 -[NSInvocation invoke] + 291
          27  CoreFoundation                 0x196ec6114 -[NSInvocation invokeWithTarget:] + 59
          28  UIKitCore                     0x1c458bd94 -[_UIQueueingProxy forwardInvocation:] + 367
          29  CoreFoundation                 0x196fe54b4 ___forwarding___ + 639
          30  CoreFoundation                 0x196fe745c _CF_forwarding_prep_0 + 91
          31  CoreFoundation                 0x196fe7600 __invoking___ + 143
          32  CoreFoundation                 0x196ec5530 -[NSInvocation invoke] + 291
          33  CoreFoundation                 0x196ec6114 -[NSInvocation invokeWithTarget:] + 59
          34  CoreFoundation                 0x196fe54b4 ___forwarding___ + 639
          35  CoreFoundation                 0x196fe745c _CF_forwarding_prep_0 + 91
          36  CoreFoundation                 0x196fe7600 __invoking___ + 143
          37  CoreFoundation                 0x196ec5530 -[NSInvocation invoke] + 291
          38  libdispatch.dylib             0x196a1a484 _dispatch_client_callout + 15
          39  libdispatch.dylib             0x1969f13f0 _dispatch_block_invoke_direct$VARIANT$armv81 + 215
          40  FrontBoardServices             0x199a53a9c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 39
          41  FrontBoardServices             0x199a53728 -[FBSSerialQueue _performNext] + 415
          42  FrontBoardServices             0x199a53d44 -[FBSSerialQueue _performNextFromRunLoopSource] + 55
          43  CoreFoundation                 0x196f701cc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 23
          44  CoreFoundation                 0x196f7014c __CFRunLoopDoSource0 + 87
          45  CoreFoundation                 0x196f6fa30 __CFRunLoopDoSources0 + 175
          46  CoreFoundation                 0x196f6a8fc __CFRunLoopRun + 1039
          47  CoreFoundation                 0x196f6a1cc CFRunLoopRunSpecific + 435
          48  GraphicsServices               0x1991e1584 GSEventRunModal + 99
          49  UIKitCore                     0x1c41e1054 UIApplicationMain + 211
          50  libxpc.dylib                   0x196c3c098 _xpc_objc_main + 555
          51  libxpc.dylib                   0x196c3ea30 xpc_main + 179
          52  Foundation                     0x19799cdb0 -[NSXPCListener resume] + 179
          53  PlugInKit                     0x19cbbb498 0x19cba8000 + 79000
          54  PlugInKit                     0x19cbbb2c4 0x19cba8000 + 78532
          55  PlugInKit                     0x19cbbb848 0x19cba8000 + 79944
          56  Foundation                     0x197b846bc NSExtensionMain + 63
          57  libdyld.dylib                 0x196a2abb4 start + 3
          
          
          
          
          Thread 0 name:  Dispatch queue: com.apple.main-thread
          Thread 0 Crashed:
          0   libsystem_kernel.dylib         0x0000000196b77104 __pthread_kill + 8
          1   libsystem_pthread.dylib       0x0000000196bf6998 pthread_kill$VARIANT$armv81 + 296
          2   libsystem_c.dylib             0x0000000196aced78 abort + 140
          3   libc++abi.dylib               0x0000000196198f78 __cxa_bad_cast + 0
          4   libc++abi.dylib               0x0000000196199120 default_unexpected_handler+ 8480 () + 0
          5   libobjc.A.dylib               0x00000001961b1e48 _objc_terminate+ 28232 () + 124
          6   libc++abi.dylib               0x00000001961a50fc std::__terminate(void (*)+ 57596 ()) + 16
          7   libc++abi.dylib               0x00000001961a5188 std::terminate+ 57736 () + 84
          8   libdispatch.dylib             0x0000000196a1a498 _dispatch_client_callout + 36
          9   libdispatch.dylib             0x00000001969f13f0 _dispatch_block_invoke_direct$VARIANT$armv81 + 216
          10  FrontBoardServices             0x0000000199a53a9c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40
          11  FrontBoardServices             0x0000000199a53728 -[FBSSerialQueue _performNext] + 416
          12  FrontBoardServices             0x0000000199a53d44 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
          13  CoreFoundation                 0x0000000196f701cc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
          14  CoreFoundation                 0x0000000196f7014c __CFRunLoopDoSource0 + 88
          15  CoreFoundation                 0x0000000196f6fa30 __CFRunLoopDoSources0 + 176
          16  CoreFoundation                 0x0000000196f6a8fc __CFRunLoopRun + 1040
          17  CoreFoundation                 0x0000000196f6a1cc CFRunLoopRunSpecific + 436
          18  GraphicsServices               0x00000001991e1584 GSEventRunModal + 100
          19  UIKitCore                     0x00000001c41e1054 UIApplicationMain + 212
          20  libxpc.dylib                   0x0000000196c3c098 _xpc_objc_main + 556
          21  libxpc.dylib                   0x0000000196c3ea30 xpc_main + 180
          22  Foundation                     0x000000019799cdb0 +[NSXPCListener serviceListener] + 0
          23  PlugInKit                     0x000000019cbbb498 0x19cba8000 + 79000
          24  PlugInKit                     0x000000019cbbb2c4 0x19cba8000 + 78532
          25  PlugInKit                     0x000000019cbbb848 0x19cba8000 + 79944
          26  Foundation                     0x0000000197b846bc NSExtensionMain + 64
          27  libdyld.dylib                 0x0000000196a2abb4 start + 4
          
          
          Thread 1:
          0   libsystem_pthread.dylib       0x0000000196bfece8 start_wqthread + 0
          
          
          Thread 2:
          0   libsystem_pthread.dylib       0x0000000196bfece8 start_wqthread + 0
          
          
          Thread 3:
          0   libsystem_pthread.dylib       0x0000000196bfece8 start_wqthread + 0
          
          
          Thread 4 name:  com.apple.uikit.eventfetch-thread
          Thread 4:
          0   libsystem_kernel.dylib         0x0000000196b6bed0 mach_msg_trap + 8
          1   libsystem_kernel.dylib         0x0000000196b6b3a8 mach_msg + 72
          2   CoreFoundation                 0x0000000196f6fbc4 __CFRunLoopServiceMachPort + 236
          3   CoreFoundation                 0x0000000196f6aa60 __CFRunLoopRun + 1396
          4   CoreFoundation                 0x0000000196f6a1cc CFRunLoopRunSpecific + 436
          5   Foundation                     0x000000019795f404 -[NSRunLoop+ 33796 (NSRunLoop) runMode:beforeDate:] + 300
          6   Foundation                     0x000000019795f274 -[NSRunLoop+ 33396 (NSRunLoop) runUntilDate:] + 88
          7   UIKitCore                     0x00000001c42ce808 -[UIEventFetcher threadMain] + 136
          8   Foundation                     0x0000000197a921ac __NSThread__start__ + 1040
          9   libsystem_pthread.dylib       0x0000000196bfb2ac _pthread_body + 128
          10  libsystem_pthread.dylib       0x0000000196bfb20c _pthread_start + 48
          11  libsystem_pthread.dylib       0x0000000196bfecf4 thread_start + 4
          
          
          Thread 5:
          0   libsystem_pthread.dylib       0x0000000196bfece8 start_wqthread + 0
          
          
          Thread 6:
          0   libsystem_kernel.dylib         0x0000000196b6bf24 semaphore_timedwait_trap + 8
          1   libdispatch.dylib             0x00000001969e8c5c _dispatch_sema4_timedwait$VARIANT$armv81 + 64
          2   libdispatch.dylib             0x00000001969e95ac _dispatch_semaphore_wait_slow + 72
          3   libdispatch.dylib             0x00000001969fc8ec _dispatch_worker_thread + 344
          4   libsystem_pthread.dylib       0x0000000196bfb2ac _pthread_body + 128
          5   libsystem_pthread.dylib       0x0000000196bfb20c _pthread_start + 48
          6   libsystem_pthread.dylib       0x0000000196bfecf4 thread_start + 4
          
          
          Thread 0 crashed with ARM Thread State (64-bit):
              x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000280c7a9b7
              x4: 0x00000001961a8b81   x5: 0x000000016cf4e470   x6: 0x000000000000006e   x7: 0xffffffff00000600
              x8: 0x0000000000000800   x9: 0x0000000196bf6870  x10: 0x0000000196bf1ef4  x11: 0x0000000000000003
             x12: 0x0000000000000053  x13: 0x0000000000000000  x14: 0x0000000000000010  x15: 0x000000000000002c
             x16: 0x0000000000000148  x17: 0x0000000000000000  x18: 0x0000000000000000  x19: 0x0000000000000006
             x20: 0x00000001032f6b80  x21: 0x000000016cf4e470  x22: 0x0000000000000407  x23: 0x00000001032f6c60
             x24: 0x0000000000001d03  x25: 0x0000000000001c03  x26: 0x0000000000000000  x27: 0x0000000000000000
             x28: 0x0000000281e46208   fp: 0x000000016cf4e3d0   lr: 0x0000000196bf6998
              sp: 0x000000016cf4e3a0   pc: 0x0000000196b77104 cpsr: 0x00000000
            • Re: Error by RPSystemBroadcastPickerView "Unbalanced calls to begin/end appearance transitions"
              QuinceyMorris Level 8 Level 8 (5,930 points)

              In what method do you add the picker view as a subview of one of your own views?

               

              Note that, in relation to what bws2007 originally said, that adding a subview in viewDidLoad is likely a Very Bad Idea™.

               

              At that point, the view belonging to the view controller has been loaded, but the view hierarchy for the screen probably isn't set up yet. I would recommend waiting until viewWillAppear instead.

               

              Also, given that your crash occurred outside your own code, submit a bug report too.

                • Re: Error by RPSystemBroadcastPickerView "Unbalanced calls to begin/end appearance transitions"
                  Jilai Yuan Level 1 Level 1 (0 points)

                  My code is not the same as bt2007. When I receive a notification, I call this method to init my custom view:

                  - (void)presentMyCustomView
                  {
                      MyCustomView *myCustomView = [[[[UIApplication sharedApplication] delegate] window] viewWithTag:kMyCustomViewTag];
                      if (!myCustomView)
                      {
                          myCustomView = [[MyCustomView alloc] init];
                          myCustomView.tag = kMyCustomViewTag;
                          [[[[UIApplication sharedApplication] delegate] window] addSubview:myCustomView];
                          [myCustomView release];
                      }
                  }
                  

                  In MyCustomView class's init method, I create RPSystemBroadcoatPickerView and add it to MyCustomView

                      RPSystemBroadcastPickerView *broadcastPicker = [[RPSystemBroadcastPickerView alloc] initWithFrame:CGRectMake(0, 0, 100.f, 100.f)];
                      broadcastPicker.preferredExtension = @"xxxxx";
                      self.broadcastPicker = broadcastPicker;
                      [self addSubview:broadcastPicker];
                      [broadcastPicker release];
                  

                  But when I run my project, sometimes UI freeze and all other elements on MyCustomView cannot touched. Some RPBroadcastPicker crashlog will be found in device logs.

                   

                  Thanks.