简体   繁体   English

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

[英]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.

相关问题 为什么我在XCode中收到过时的警告 - Why am I getting a deprecated warning in XCode 为什么我看到有关NSAutoreleasePool不可用的消息警告? - Why am I seeing a message warning about NSAutoreleasePool being unavailable? 为什么我的应用程序只使用了大约36MB内存,但我仍然收到低内存警告? - why did my app just used about 36MB memory but i still receive low memory warning? 为什么在以下实例方法上收到“冲突类型”警告? - Why am I getting a “Conflicting types” warning on the below instance method? 为什么我收到警告“找到名为“ center”的多个方法” - Why am I am getting the warning “Multiple methods named 'center' found” 为什么我的CLLocationmanager委托没有被调用? - Why is my CLLocationmanager delegate not getting called? 为什么在安装iPhone应用程序时出现CGContext错误? - Why am I getting CGContext errors when installing an iPhone app? 在uitextfield的委托中得到警告 - getting warning in uitextfield's delegate 我在Xcode for iOS中得到了“枚举类型的隐式转换”警告,我不知道为什么 - I am getting an “Implicit conversion from enumeration type” warning in Xcode for iOS and I don't know why 当我从其他应用程序向我的应用程序添加文件夹时出现错误,例如没有此类文件或目录 - when i am adding folder from other app to my app am getting error like no such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM