I am running into an exception whenever I try to open the app's window in visionOS simulator. The exception error message says:
"Thread 1: "Error in UIKit client: window visibility must match its layer visibility!""
This is the same code that runs just fine on iOS where I setup the app's window and tab bar controller in code:
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Setup the UI - Override point for customization after app launch
UIWindowScene *firstScene = (UIWindowScene *) [[[[UIApplication sharedApplication] connectedScenes] allObjects] firstObject];
self.mainWindow = [[UIWindow alloc] initWithWindowScene:firstScene];
self.mainWindow.backgroundColor = [UIColor systemBackgroundColor];
self.tabController = [[UITabBarController alloc] init];
[self.tabController definesPresentationContext];
self.mainWindow.rootViewController = self.tabController;
[self.mainWindow makeKeyAndVisible];
// setup the tab bar later
The exception comes from the makeKeyAndVisible
line. I'm not sure what I need to do differently for a visionOS app to make it work.
I'm using Xcode 15.1 Beta 2.