Hello
I have problem with didFinishLaunching methods. I am really getting confused about what was the problem and that’s why I pasted all my code. The problem was the application didn’t launch, it crashed, and it show me this message in console:
**[Demo1AppDelegate setMapViewController:]: unrecognized selector sent to instance 0x5649a30
2011-05-25 14:17:58.724 Demo1[10630:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Demo1AppDelegate setMapViewController:]: unrecognized selector sent to instance 0x5649a30'**
I am using this code
In Demo1appDelegate.h file
#import <UIKit/UIKit.h>
#import "MapViewController.h"
@interface Demo1AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
MapViewController *mapViewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
And in
Demo1AppDelegate.m file
#import "Demo1AppDelegate.h"
@interface Demo1AppDelegate ()
@property (nonatomic, retain) MapViewController *mapViewController;
@end
@implementation Demo1AppDelegate
@synthesize window;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
MapViewController *viewController = [[MapViewController alloc] init];
self.mapViewController = viewController;
[viewController release];
[window addSubview:self.mapViewController.view];
[window makeKeyAndVisible];
return YES;
}
- (void)dealloc {
[mapViewController release];
[window release];
[super dealloc];
}
@end
I think
is the problem. You do not have
@synthesizeformapViewController. So you cannot access throughselfOr another option is to try this