[英]Why am I getting this warning about my app delegate and CLLocationManageDelegate?
Observe this perfectly simple UIViewController subclass method: 观察这个非常简单的UIViewController子类方法:
-(IBAction)launchSearch
{
OffersSearchController *search = [[OffersSearchController alloc]
initWithNibName:@"OffersSearchView" bundle:nil];
EverWondrAppDelegate *del = [UIApplication sharedApplication].delegate;
[del.navigationController pushViewController:search animated:YES];
[search release];
}
On the line where I get *del, I am getting a compiler warning that reads, Type 'id <UIApplicationDelegate>' does not conform to the 'CLLocationManagerDelegate' protocol
. 在获得* del的行上,我得到一条编译器警告,内容为:
Type 'id <UIApplicationDelegate>' does not conform to the 'CLLocationManagerDelegate' protocol
。 In fact, my app delegate DOES conform to that protocol, AND what I'm doing here has nothing at all to do with that. 实际上,我的应用程序委托确实符合该协议,并且我在这里所做的与该协议完全无关。 So what's up with that message?
那么该消息是怎么回事?
Secondary question: sometimes I can get to my navigationController via self.navigationController
, and sometimes I can't, and have to go to my app delegate's property to get it like I'm doing here. 第二个问题:有时我可以通过
self.navigationController
进入我的navigationController,有时却不能,必须像我在这里一样去我的应用程序委托的属性来获取它。 Any hint about why that is would be very useful. 关于为什么这样做的任何提示将非常有用。
Try this: 尝试这个:
EverWondrAppDelegate *del = (EverWondrAppDelegate *)[UIApplication sharedApplication].delegate;
With regards to your second question: no idea why this would be happening. 关于第二个问题:不知道为什么会这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.