didUpdateLocation Method Never Called

后端 未结 6 894
南旧
南旧 2021-01-05 10:40

I am making one app on iphone sdk4.0.In that did update location method never called. I have given my code below.Please help.Thanks in advance.

-(id)init
{
          


        
6条回答
  •  抹茶落季
    2021-01-05 10:49

    After you alloc and init your location manager, check to see if location services are allowed. This code is from Apple's "LocateMe" code sample

    if (locationManager.locationServicesEnabled == NO) {
        UIAlertView *servicesDisabledAlert = [[UIAlertView alloc] initWithTitle:@"Location Services Disabled" message:@"You currently have all location services for this device disabled. If you proceed, you will be asked to confirm whether location services should be reenabled." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [servicesDisabledAlert show];
        [servicesDisabledAlert release];
    }
    

    If you're testing with the simulator, try testing with a device instead. The simulator requires that the computer's WiFi is turned on, and that it can locate a WiFi base station that's in it's database of known locations.

提交回复
热议问题