What causes this error? [UIFocus] Failed to update focus with context

I have an app that just started becoming unresponsive. I just updated my Mac to 12.3 and Xcode to 13.3.

When compiling my iOS app for iPhone and iPad, it deploys just fine to devices. But, when running in the Simulator the UI stops functioning after a few renders. No input seems to be received, no renders are happening.

In the log I see this message:

[UIFocus] Failed to update focus with context <UIFocusUpdateContext: 0x60000081a8a0: previouslyFocusedItem=(null), nextFocusedItem=(null), focusHeading=None>. No additional info available.

What is causing this only for the Simulator? (I saw another thread with similar-looking questions.)

I even created a completely new Xcode Project, and though the UI is still responsive, in the logs I see:

[UIFocus] Failed to update focus with context <UIFocusUpdateContext: 0x6000025aa940: previouslyFocusedItem=(null), nextFocusedItem=(null), focusHeading=None>. No additional info available.
[UIFocus] Deferring focus update to item <SwiftUI.ListTableViewCell: 0x7fd632846a00>. No additional info available.
[UIFocus] Failed to update focus with context <UIFocusUpdateContext: 0x6000025a5fe0: previouslyFocusedItem=(null), nextFocusedItem=(null), focusHeading=None>. No additional info available.
[UIFocus] Deferring focus update to item <SwiftUI.ListTableViewCell: 0x7fd63284ca00>. No additional

This feels like a relatively new error I haven't seen before.

I get the same thing but the simulator does not stop responding.

see same

Similarly, I just updated to 12.3 and XCode 13.3 . See the same as above.

Same here, since today, Xcode 13.3

I see the same error (Xcode 13.3, on OS 12.3 on Apple Silicon), but the simulator has NOT stopped responding. The log output is continual which seems to happen when reacting with any UI component, though I have not tried to verify this at this time. The project (iOS) does use menus quite frequently which I thought was the cause of the log, and every interaction with a menu does cause this log to be issued.

Some people online say this is just a log end not to worry about it. My app is literally not working anymore. Some views are unusable suddenly. Both on simulator and devices.

Same

I had this error:

[UIFocus] Failed to update focus with context <UIFocusUpdateContext: 0x6000008857c0: previouslyFocusedItem=(null), nextFocusedItem=(null), focusHeading=None>. No additional info available.
[UIFocus] Deferring focus update to item <TableViewCell: 0x7fb3da047000>. No additional info available.

in a table view which is continuously updated. Konsole/log was spammed with the error message.

Adding the following code to the table view made most of the log entries go away:

if #available(macCatalyst 15.0, *) {
    tableView.allowsFocus = false
}

You could also try

func tableView(_ tableView: UITableView, canFocusRowAt indexPath: IndexPath) -> Bool {
    return false
}

or

override func shouldUpdateFocus(in context: UIFocusUpdateContext) -> Bool {
    return false
}

Then, adding -UIFocusLoggingEnabled YES to the app's start arguments could help understanding what's going on, see https://developer.apple.com/documentation/uikit/focus-based_navigation/debugging_focus_issues_in_your_app

The whole topic appears to be related to https://developer.apple.com/videos/play/wwdc2021/10260 (tag: wwdc21-10260) and/or iOS 15.

If you create a new iOS SwiftUI App based on the "Hello, world!" template and run it under Mac Catalyst "out-of-the-box" (i.e. no further change) you'll also see a couple of [UIFocus] Failed to update focus with context <UIFocusUpdateContext: ***: previouslyFocusedItem=(null), nextFocusedItem=(null), focusHeading=None>. No additional info available. messages. From this I'd conclude that the message as such is not necessarily an indication of a problem in the app itself.

I created a new iOS SwiftUI App (Multiplatforms) based on the "Hello, world!" and just run it on Simulator.app (iPad Air 5th) then logged: [UIFocus] Failed to update focus with context <UIFocusUpdateContext: 0x6000024d8140: previouslyFocusedItem=(null), nextFocusedItem=(null), focusHeading=None>. No additional info available. macOS 12.3.1 and Xcode 13.3.1

and, I don't know if this is relevant or not, but the following logs are now also produced. It is working at the moment. "[Assert] Using legacy initializer -[UIFocusRegion initWithFrame:] for region <_UIFocusItemRegion: 0x6000027916c0> - if this region is If this region is coming from UIKit, this is a UIKit bug."

Same issue here, Xcode 13.3. My UI stops responding on all iPads

Apple needs to update Xcode, this bug sucks. Messing our workflow, can't test iPad Apps

I had the same issue using two tables on a view. The fist would populate but the second wouldn't and II was getting the above error. I was scratching my head, Googling the issue etc. Then I realised I forgot to set the delegate for the second table.

I have the seem problem, Xcode 13.3

Found the solution!

I'm using Xcode 13.3.1, follow the instructions below:

  1. Go to your-target -> Edit Scheme (next to the picker of your devices).
  2. Then go to Run -> Arguments.
  3. Inside Environment Variables, add Name OS_ACTIVITY_MODE and Value disable.
  4. Close the window and rebuild your target!

Hopefully can help!

What causes this error? [UIFocus] Failed to update focus with context
 
 
Q