One of my old apps is not working with iOS8. When I start the app up, and try to tap on the screen anywhere, I get this message in my console:
unexpected nil window in _UIApplicationHandleEventFromQueueEvent,
_windowServerHitTestWindow: <UIWindow: 0x7fe4d3e52660; frame = (0 0; 320 568);
opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fe4d3e2c450>;
layer = <UIWindowLayer: 0x7fe4d3e86a10>>
I'm using an old style MainWindow.xib. In the MainWindow.xib is my Window object, as well as a UINavigationController which has its first View Controller defined within as well. The image below is showing the Outlets connected to the App Delegate.
The white "view" in the screenshot below is the UIWindow. The view on the right is the UINavigationController (nav bar hidden) with the first ViewController defined inside it.
How do I fix this without recreating the entire app from scratch with a new project?
EDIT: I just discovered there is a TINY strip wherein my buttons will actually receive their taps/clicks.
I've also noticed that my self.view.window is nil. How do I make sure that is set?
Additional to B H answer. Also look this answer.
Got this issue when launching my landscape only app from portrait orientation (also the app shouldn't be presented in recently opened apps list, which can be seen by pressing Home button twice. Perhaps, iOS somehow caches the orientation and window size).
My code was
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];
I set W+H
autoresizing mask for window, it didn't help me, because the window don't being resized on rotation, but the transform
matrix is changed.
The solution is simple
self.window = [UIWindow new];
[self.window makeKeyAndVisible];
self.window.frame = [[UIScreen mainScreen] bounds];
So the frame is set AFTER the window get its orientation from root view controller.
You don't have to add any code to fix this.
Open the main xib file and find "Window" from the left side and enable Visible at Launch
and Full Screen at launch
.
Check out your Window nib file and make sure it is taking up the full screen. I had a similar issue on my app where touch events weren't being registered on a strip on the right side. Once I set my MainWindow.xib to take up the Full Screen, I had no more errors and touch events were working again. My app was also being displayed in Landscape but my MainWindow.xib had portrait dimensions.
Sometimes it's just simple setting that's missing some value: Click on Project(whatever you named your project) name item then make sure General tab is selected and scroll to the bottom. Look for App icons and Launch Images make sure there is some value in the Launch Screen File field, this should be either Main or LaunchScreen
In case somebody finds this useful:
In my case, I had used
self.window = [[UIWindow alloc] init];
instead of
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
and that was the reason for the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With