I am a new programmer… i have following problem..
Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘-[UIViewController _loadViewFromNibNamed:bundle:] loaded the “MapView” nib but the view outlet was not set.’
I do following
1) create a Window based application and name the project as MapApp.
2) Add the MapKit framework to the project. (Control + Click Frameworks folder -> Add -> Existing Frameworks)
3) Create a new view controller class and call it MapViewController. (not create it’s xib)
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface MapViewController : UIViewController<MKMapViewDelegate> {
IBOutlet UITextField *addressField;
IBOutlet UIButton *goButton;
IBOutlet MKMapView *mapView;
}
@end
4) create a xib file named MapView.xib. Set its type to MapViewController….
File's Owner--------->MapViewController... i already set...
in my appDelegate.m file
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
mapViewController = [[MapViewController alloc] initWithNibName:@"MapView" bundle:nil];
[window addSubview:mapViewController.view];
[self.window makeKeyAndVisible];
return YES;
}
but when i build….
the following exception occured......
Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘-[UIViewController _loadViewFromNibNamed:bundle:] loaded the “MapView” nib but the view outlet was not set.’
thanks for help …..
Check that the file’s owner of the MapView nib is set to class
MapViewController. Then connect the view outlet from file’s owner to the main view of that nib.