简体   繁体   中英

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

Observe this perfectly simple UIViewController subclass method:

-(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 . 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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