Error when using system keyboard alongside custom Views in VisionOS application

Hello, I am running into a bug when I try to use a TextField in my SwiftUI project. As soon as I click on the TextField to begin entering characters, this warning appears twice:

Trying to convert coordinates between views that are in different UIWindows, which isn't supported. Use convertPoint:fromCoordinateSpace: instead.

followed by this warning:

Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600002241720 'accessoryView.bottom' _TtGC7SwiftUIP10$1c7cfcbc018InputAccessoryHostVS_P10$1c7cfcc5417InputAccessoryBar_:0x102973200.bottom == _UIRemoteKeyboardPlaceholderView:0x1038ef360.top + 86   (active)>",
    "<NSLayoutConstraint:0x60000226d540 'inputView.top' V:[_TtGC7SwiftUIP10$1c7cfcbc018InputAccessoryHostVS_P10$1c7cfcc5417InputAccessoryBar_:0x102973200]-(0)-[_UIRemoteKeyboardPlaceholderView:0x1038ef360]   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x60000226d540 'inputView.top' V:[_TtGC7SwiftUIP10$1c7cfcbc018InputAccessoryHostVS_P10$1c7cfcc5417InputAccessoryBar_:0x102973200]-(0)-[_UIRemoteKeyboardPlaceholderView:0x1038ef360]   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
Type: Error | Timestamp: 2024-07-31 06:30:56.177554-04:00 | Process: SG-002-Tutorial1 | Library: UIKitCore | Subsystem: com.apple.UIKit | Category: LayoutConstraints | TID: 0xfcd38

This is then followed by this series of error messages and my application freezes.

To clarify, in my project's source, I am not setting any constraints, or converting coordinates between views (at least not knowingly).

I am going to attempt to reduce this to a simpler project which replicates the error, but I'd be thankful for any insights. I tried making a symbolic checkpoint as suggested in the warning, but this hit the breakpoint in a file of Assembly code I am not sure what to do with.

Answered by Vision Pro Engineer in 798448022

Hey @anon000,

Thanks so much for that sample project! I'm not able to reproduce the issue on Xcode 16 / visionOS 2.0. Are you able to reproduce with the latest betas?

You can ignore the convertPoint:fromCoordinateSpace: warning since you are not using any of the convertPoint:fromView: methods. Since there's a few issues in your bug report, I've filed a separate bug for this issue.

Thanks,

Michael

Hey @anon000,

Based on the information provided I think you might be experiencing a system bug. I'd love to take a look at test project to help better understand what's going on.

I'd greatly appreciate it if you could open a bug report, include a project that replicates the issue, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

If you're not familiar with preparing a test project, take a look at Creating a test project.

Thanks!

Michael

Hey Michael, thanks for the answer, I'll check those links and put this test project together.

@Vision Pro Engineer hello Michael, I think I've narrowed down the problem to the parts directly involved. I'm not sure which of the parts of the project are responsible, but if I remove any of them, the crash no longer occurs. I have created a report in the Feedback assistant with this FB number: FB14606725 . It includes a link to a test project and the console log of the crash.

Accepted Answer

Hey @anon000,

Thanks so much for that sample project! I'm not able to reproduce the issue on Xcode 16 / visionOS 2.0. Are you able to reproduce with the latest betas?

You can ignore the convertPoint:fromCoordinateSpace: warning since you are not using any of the convertPoint:fromView: methods. Since there's a few issues in your bug report, I've filed a separate bug for this issue.

Thanks,

Michael

Hey Michael, I can confirm that upgrading Xcode to 16 and using the 2.0 visionOS simulator fixes the issue, that's a relief. Thank you for your help.

Error when using system keyboard alongside custom Views in VisionOS application
 
 
Q