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.

Post not yet marked as solved Up vote post of amyseqmedia Down vote post of amyseqmedia
7.3k views
  • I get the same thing but the simulator does not stop responding.

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

  • 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.

Replies

see same

Same here, since today, Xcode 13.3

  • Same here. App is not have problems with searchable on SwiftUI views. Can't search. Keyboard won't come up. Also using Picker views, they do not respond to taps.

Add a Comment

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.

Add a Comment

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

  • I have the same issue, did you fix it?

Add a Comment

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!

  • Please add a screenshot of where to find and add.

  • thanks it worked! :-)

  • This was the solution for me as well. Running on Version 13.3.1 (13E500a). Thanks!!

How/Why does this work?