Got Application windows are expected to have a root view


Hi Nerds,

I got as far a p 109 in Chapter 5: Mapkit and Text Input…but ran into an error that I couldn’t figure out.

When I ran the application, I got a black window, and I got an Application windows are expected to have a root view controller error message.

It was driving me crazy trying to find out where the error came from…but I found it out.

It turns out that when following the directions (Chapter 5, p 107) that there needs to be a connection made for File’s Owner->Outlets->view to the “View”. However, before that you are instructed to add the MKMapView, the UITextField, and the UIActivityIndicatorView before making the connections. I couldn’t draw the arrow to the “View” view since MKMapView was in the way…

Anyways, I moved MKMapView slightly out of the way, made the connection to the “View”, then put the MKMapView back.

Then the finished connections looked like those shown on p 107 under Figure 5.5.

I then ran the application, and it ran OK.


Thanks for posting your find. I too have been pulling my hair out (must remember to google/search this forum before baldness) trying to figure out this issue. Linking the view to the File Owner didn’t do it for me. I had to explicitly type “self.window.rootViewController = self.viewController;” into WhereamiAppDelegate.m. I’m on XCode 4 with iOS 6.1 as the target.

With that change, my app builds at this point in the chapter.