Xcode 14: [Assert] UINavigationBar decoded as unlocked for UINavigationController

In Xcode 14 RC, I'm seeing this in the Console:

[Assert] UINavigationBar decoded as unlocked for UINavigationController, or navigationBar delegate set up incorrectly. Inconsistent configuration may cause problems. navigationController=<MasterNavigationController: 0x135016200>, navigationBar=<UINavigationBar: 0x134f0aec0; frame = (0 20; 0 50); opaque = NO; autoresize = W; layer = <CALayer: 0x600000380be0>> delegate=0x135016200

The above message displays exactly four times immediately at app launch (top of the console) then does not repeat.

MasterNavigationController is the internal class for the app's navigation controller. It is in a Storyboard, with very minimal ObjC code. I am not setting any specific size for the nav bar.

I don't remember seeing this in earlier builds of Xcode, but I can't swear to it that this is new. No assertion actually fires.

Post not yet marked as solved Up vote post of mitchcohen Down vote post of mitchcohen
27k views
  • I also find that promblem.

    **How I fix it. **

    If you use storyboards. Take the arrow(Attribute inspector-> is initial view controller) from Navigation View Controller in storyboard and put it in your next View Controller.

    Simplify change initial view controller in storyboard

  • TimMan, this fixes the logs, but disables the nav controller.

Add a Comment

Replies

I get this error along with navigationItem.leftBarButtonItem & navigationItem.rightBarButtonItem (using UIBarButtonItem, both system or custom) not appearing in the UI on iOS16, but works perfectly in versions prior to iOS 16.

In iOS16, when I view Debug View Hierarchy, these elements seem to be completely missing.

On the left of the navigation bar:- UINavigationBar > _UINavigationBarContentView >> _UIButtonBarStackView = No Content On the right of navigation bar: UINavigationBar > _UINavigationBarContentView >> _UIButtonBarStackView = No content

One with warning “Width and horizontal position are ambiguous” (Left)

But in iOS15.5, we see the correct content in view and reported correctly in Debug View Hierarchy

UINavigationBar > _UINavigationBarContentView > _UIButtonBarStackView = Has content, i.e. custom UIVVIew > UILabel

We're using Storyboards too.

Even when creating a new UINavigationBar() directly in the associated viewController, I get the same behaviour in iOS16 with navigationItem.leftBarButtonItem & navigationItem.rightBarButtonItem not rendering to screen or visibile in Debug View Hierarachy.

However, when using navigationController?.popToViewController(self, animated: false), the back button to the previous view renders fine and navigation bar titles work fine in iOS16, it's just navigationItem bar buttons that are not displaying.

Same here, I didn't even touched navigationBar...

Having the same issue. My project has been created a long time ago using Storyboards (2018).

App has been updated in 2020 and so far was running fine until iOS 16 (no errors in iOS 15 or lower).

I am getting this error in the console but I don't see any visual issues:

2022-09-22 09:41:01.111985-0400 [Assert] UINavigationBar decoded as unlocked for UINavigationController, or navigationBar delegate set up incorrectly. Inconsistent configuration may cause problems. navigationController=<UINavigationController: 0x7fdf92826600>, navigationBar=<UINavigationBar: 0x7fdf9070b720; frame = (0 0; 0 50); autoresize = W; tintColor = UIExtendedGrayColorSpace 1 1; layer = <CALayer: 0x6000010907e0>> delegate=0x7fdf92826600

I also have a crash happening randomly which might be related (only under iOS 16 as well): libsystem_platform.dylib`os_unfair_lock_lock

I have added the fix for the default transparent navigationBar under iOs 15+ which worked but did not get rid of the assert error:

 //Fix Nav Bar tint issue in iOS 15.0 or later - is transparent w/o code below
  if (@available(iOS 15, *)) {
    UINavigationBarAppearance *navBarAppearance = [[UINavigationBarAppearance alloc] init];
    [navBarAppearance configureWithDefaultBackground];
    navBarAppearance.backgroundColor = [UIColor colorWithRed: 0.05 green: 0.09 blue: 0.20 alpha: 1.00];
    [UINavigationBar appearance].standardAppearance = navBarAppearance;
    [UINavigationBar appearance].compactAppearance = navBarAppearance;
    [UINavigationBar appearance].scrollEdgeAppearance = navBarAppearance;
  }

I was able to solve it by setting storyboard's build target. Open the storyboard and select the File Inspector tab. Set the "Builds For" value to your deployment target.

It will fix the error.

  • Unfortunately it did not fix it for me either.

Add a Comment

I was able to solve it by setting storyboard's build target. Open the storyboard and select the File Inspector tab. Set the "Builds For" value to your deployment target.

For me it is already set to correct value. Even when I set it to different version and then back to Deployment Target version, the error in console stays.

I'm also facing this issue in a brand new iOS project in Xcode 14 (14A309) with a minimum deployment target of iOS 16.

I tried changing the Lock setting from the Identity Inspector's Document section for both the navigation controller and its navigation bar. I also tried manually assigning an empty delegate to my view controller's navigationController?.navigationBar property, but all of these attempts did not resolve this assertion message.

I'm assuming it is simply an oversight; one of those harmful internal logs that should be hidden, but left visible by mistake, as it doesn't seem to cause any visual issues for me when using the default navigation controller scene in the storyboard.

I hope it will be fixed or silenced in Xcode 14.1

I also have this Assert in the log. I also have a problem with the view that I am troubleshooting. I guess we just ignore it for now?

You are all misinterpreting this log message. I have found it to be a daily source of inspiration.

  • I feel calmer already!

Add a Comment

@nirav78 storyboard was set to the same value as deployment target (and minimum deployment) ; and I get the error in iOS 16, Xcode 14.0

I just upgraded to Xcode Version 14.0.1 (14A400) last week, and now I too am seeing this error message. Whats also frustrating is when copying and pasting the error message into the search bar on the main page of these forums, no threads are found. I paste the exact same text into Google and this thread is first on the list. I'm assuming many of you found your way here as a result of a Google search as well.

Well, either way, glad to see I'm not the only one encountering this. My project is a very basic "sample app" for developers using our Framework, setup entirely in a Storyboard with a handful of scenes.

I did double check the Deployment Target as mentioned above, this was already properly set.

I'm getting this error message, too, but it appears to be benign. How awesome would it be if the folks who make the changes to XCode ALSO wrote some apps?

I have this problem with similar configuration (old storyboard app with navigation controller etc.) and I noticed that the warning shows the frame for the navigation bar has zero width. I wonder if some code is checking on the navigation bar's frame, sees that it's not configured right, and is falling through to show us this warning?

I'm having this same problem? Storyboard with one navigation controller. Does it just not like the iOS16 Simulators? Will downloading a previous version of the simulator fix it?

For me, I found a workaround: first i didn't make the TableViewController and then embedding it, but I started by putting the Navigation controller first (this will make the TableViewController appear automatically by default). Then I went on the TableViewController and set it as Initial View Controller. By doing so the error went away. Needless to say but I also needed to change ViewController.swift into class ViewController: UITableViewController and of course the Root View Controller must point to the classViewController.

  • THIS IS THE FIX.. just set the View Controller meant to be your Root as the initial one in the Attributes inspector

  • This worked for me too. For those like me that benefit from detailed steps:

    Open StoryBoard Make sure there is a Navigation Controller embedded/linked to first/initial ViewController Click on Initial/Main/First View Controller. Open the Identity Inspector in high hand pane/column - in second block labelled View Controller make sure the Title is correct and check the box - Is Initial View Controller.

    Run your project and the error is gone. Thank you AAABC.

Add a Comment

I see, use Storyboard UINavigationBar has parent UINavigationController as delegate. I don't know how to disallow this behaviour.