我已經啓用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 *'
如何刪除警告?
謝謝。