material-components-ios icon indicating copy to clipboard operation
material-components-ios copied to clipboard

[BottomNavigation] [Beta] MDCBottomNavigationBarController does not follow UIViewController init pattern; is not compatible with nib archiving

Open CapnSpellcheck opened this issue 5 years ago • 0 comments

A clear and concise description of what the bug is.

Reproduction steps

Steps to reproduce the behavior:

  1. Create a xib file.
  2. Insert a UIViewController object into the xib. Set custom class of this object: MDCBottomNavigationController.
  3. In code, attempt to set view controllers on nav bar controller.
  4. Build and run the app. Navigate to the created xib file.

Expected behavior

The nib file loads. The call to setViewControllers: finishes without error.

Actual behavior

Inside setViewControllers: an exception results because -[MDCBottomNavigationBarController init] never executed. self.contents is nil

2020-06-08 15:20:58.513951-0700 Twinkle[30869:340802] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSLayoutConstraint for <NSLayoutXAxisAnchor:0x600002fba800 "UIView:0x7fa80865f7f0.leading">: A constraint cannot be made from <NSLayoutXAxisAnchor:0x600002fba800 "UIView:0x7fa80865f7f0.leading"> to a constant. Location anchors require being paired.' *** First throw call stack: ( 0 CoreFoundation 0x000000010b1136fb exceptionPreprocess + 331 1 libobjc.A.dylib 0x00000001099e7ac5 objc_exception_throw + 48 2 CoreFoundation 0x000000010b113555 +[NSException raise:format:] + 197 3 Foundation 0x0000000108f1c3fb +[NSLayoutConstraint constraintWithAnchor:relatedBy:toAnchor:multiplier:constant:] + 411 4 Twinkle 0x0000000106a443fe -[MDCBottomNavigationBarController addConstraintsForChildViewControllerView:] + 222 5 Twinkle 0x0000000106a40815 -[MDCBottomNavigationBarController setSelectedViewController:] + 885 6 Twinkle 0x0000000106a41024 -[MDCBottomNavigationBarController setViewControllers:] + 404 7 Twinkle 0x0000000106529629 $s7Twinkle0A23BottomNavViewControllerC11viewDidLoadyyF + 201 8 Twinkle 0x00000001065296f4 $s7Twinkle0A23BottomNavViewControllerC11viewDidLoadyyFTo + 36 9 UIKitCore 0x0000000119d62c77 -[UIViewController awakeFromNib] + 129 10 Twinkle 0x000000010652943d $s7Twinkle0A23BottomNavViewControllerC12awakeFromNibyyF + 77 11 Twinkle 0x0000000106529544 $s7Twinkle0A23BottomNavViewControllerC12awakeFromNibyyFTo + 36 12 UIKitCore 0x0000000119fe986e -[UINib instantiateWithOwner:options:] + 2365 13 Twinkle 0x000000010659950a $s7Twinkle19LoginViewControllerC19continueToMatchPlay33_41FFD07785E4830D8CBD2D88799BA7C0LLyyFyAA14KonnichiwaBaseCcfU + 970 14 Twinkle 0x0000000106557533 $s7Twinkle9APIClientC10konnichiwa14successHandler07failureE09Alamofire11DataRequestCyAA14KonnichiwaBaseCc_ys5Error_pcSgtFyAG0H8ResponseVyypGcfU_yypXEfU + 243 15 Twinkle 0x0000000106577061 $s7Twinkle9APIClientC10konnichiwa14successHandler07failureE09Alamofire11DataRequestCyAA14KonnichiwaBaseCc_ys5Error_pcSgtFyAG0H8ResponseVyypGcfU_yypXEfU_TA + 17 16 Twinkle 0x0000000106754698 $s9Alamofire6ResultO9withValueyACyxGyxKXEKF + 344 17 Twinkle 0x0000000106557264 $s7Twinkle9APIClientC10konnichiwa14successHandler07failureE09Alamofire11DataRequestCyAA14KonnichiwaBaseCc_ys5Error_pcSgtFyAG0H8ResponseVyypGcfU_ + 388 18 Twinkle 0x0000000106572b2d $s7Twinkle9APIClientC10konnichiwa14successHandler07failureE09Alamofire11DataRequestCyAA14KonnichiwaBaseCc_ys5Error_pcSgtFyAG0H8ResponseVyypGcfU_TA + 29 19 Twinkle 0x00000001067491eb $s9Alamofire11DataRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0CSg_xyAA0B8ResponseVy16SerializedObjectQzGctAA0bkF8ProtocolRzlFyycfU_yycfU_ + 411 20 Twinkle 0x0000000106752308 $s9Alamofire11DataRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0CSg_xyAA0B8ResponseVy16SerializedObjectQzGctAA0bkF8ProtocolRzlFyycfU_yycfU_TA + 40 21 Twinkle 0x000000010652e65d $sIeg_IeyB_TR + 45 22 libdispatch.dylib 0x000000010d693d7f _dispatch_call_block_and_release + 12 23 libdispatch.dylib 0x000000010d694db5 _dispatch_client_callout + 8 24 libdispatch.dylib 0x000000010d6a2080 _dispatch_main_queue_callback_4CF + 1540 25 CoreFoundation 0x000000010b07a8a9 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 26 CoreFoundation 0x000000010b074f56 __CFRunLoopRun + 2310 27 CoreFoundation 0x000000010b074302 CFRunLoopRunSpecific + 626 28 GraphicsServices 0x000000010f4242fe GSEventRunModal + 65 29 UIKitCore 0x000000011a369ba2 UIApplicationMain + 140 30 Twinkle 0x00000001065123eb main + 75 31 libdyld.dylib 0x000000010d709541 start + 1 32 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSExcepti

Platform (please complete the following information)

  • Device: iPhone 8
  • OS: 12.2

Additional context

Add any other context about the problem here.

CapnSpellcheck avatar Jun 08 '20 22:06 CapnSpellcheck