繁体   English   中英

为什么我收到有关我的应用程序委托和CLLocationManageDelegate的警告?

[英]Why am I getting this warning about my app delegate and CLLocationManageDelegate?

观察这个非常简单的UIViewController子类方法:

-(IBAction)launchSearch
{
    OffersSearchController *search = [[OffersSearchController alloc]
                                      initWithNibName:@"OffersSearchView" bundle:nil];
    EverWondrAppDelegate *del = [UIApplication sharedApplication].delegate;
    [del.navigationController pushViewController:search animated:YES];
    [search release];
}

在获得* del的行上,我得到一条编译器警告,内容为: Type 'id <UIApplicationDelegate>' does not conform to the 'CLLocationManagerDelegate' protocol 实际上,我的应用程序委托确实符合该协议,并且我在这里所做的与该协议完全无关。 那么该消息是怎么回事?

第二个问题:有时我可以通过self.navigationController进入我的navigationController,有时却不能,必须像我在这里一样去我的应用程序委托的属性来获取它。 关于为什么这样做的任何提示将非常有用。

尝试这个:

EverWondrAppDelegate *del = (EverWondrAppDelegate *)[UIApplication sharedApplication].delegate;

关于第二个问题:不知道为什么会这样。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM