0

在我的“didFinishLaunchingWithOptions”函数中,我在最后给出以下行:-

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
    return [super application:application didFinishLaunchingWithOptions:launchOptions]; 

但它给出了以下警告:-

'NSObject' may not respond to 'application:didFinishLaunchingWithOptions' function 

当我构建它时,应用程序以“未捕获的异常错误”终止

任何人都可以提出为什么会这样。谢谢

4

2 回答 2

0

尝试

[self application:application didFinishLaunchingWithOptions:launchOptions];

像 NSObject 这样的基本对象不实现didFinishLaunchingWithOptions:launchOptions

于 2012-10-01T11:44:28.183 回答
0

你应该在 didFinishLaunchingWithOptions:launchOptions 结束时返回 YES

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
return YES;
于 2012-10-01T12:24:57.487 回答