为什么我收到有关我的app delegate和CLLocationManageDelegate的警告?

时间:2010-06-14 14:28:52

标签: iphone

观察这个非常简单的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。事实上,我的应用代表DOES符合该协议,而我在这里做的事与此无关。那个消息怎么了?

次要问题:有时我可以通过self.navigationController访问我的navigationController,有时我不能,并且必须转到我的app delegate的属性来获取它,就像我在这里做的那样。任何关于为什么会这样做的提示都非常有用。

1 个答案:

答案 0 :(得分:0)

试试这个:

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

关于你的第二个问题:不知道为什么会发生这种情况。

相关问题