我启用了 ARC,在我的didFinishLaunchingWithOptions
方法中,我编写了以下代码:
AppDelegate.h:
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@end
AppDelegate.m:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
ViewController * vc = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:vc];
self.viewController = nav;
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
但是语句:self.viewController = nav;
得到一个编译警告,警告信息是:
file://.../AppDelegate.m: warning: Semantic Issue: Incompatible pointer types passing 'UINavigationController *__strong' to parameter of type 'ViewController *'
如何删除警告?
谢谢。