2

iPod Touch 2G、iOS 4.2.1を使用していますが、iOS 3.2からソフトウェアを更新した後、(Wifi三角測量を使用して)デバイスの場所を特定できません。私のコード:

-(IBAction) naitapraeguneasukoht: (id) sender 
{
     CLLocation*location=[[CLLocation alloc] initWithLatitude:57.797944 longitude:25.04858];
     MKCoordinateRegion region = {{0.0f, 0.0f}, {0.0f, 0.0f}};
     region.center = location.coordinate;
     region.span.longitudeDelta = 1.0f;
     region.span.latitudeDelta = 3.8f;

     [self.mapView setRegion:region animated:YES];
     [location release];

     self.locationManager = [[[CLLocationManager alloc] init] autorelease];
     locationManager.delegate = self;
     locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers;
     [locationManager startUpdatingLocation];
}

- (void) locationManager: (CLLocationManager *) manager didFailWithError: (NSError *) error 
{
    NSString *teade = [[NSString alloc] initWithString:@"Ei õnnestunud asukohta tuvastada"];
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:trade delegate:nil cancelButtonTitle: @"OK" otherButtonTitles:nil];
    [alert show];
    [teade release];
    [alert release];
}

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation 
{
    MKCoordinateRegion region;
    MKCoordinateSpan span;
    span.latitudeDelta=0.005f;
    span.longitudeDelta=0.005f;
    region.center=newLocation.coordinate;
    region.span=span;
    [mapView setRegion:region animated:TRUE];
}

場所を特定できないというエラーメッセージが表示されます。位置情報サービスは間違いなくオンになっています。

iOS 4.2シミュレーターは私の正しい位置を教えてくれますが、iOS5.0シミュレーターは私にクパチーノを教えてくれます。なぜそうなのか、そしてなぜそれが私のデバイスで機能しないのですか?

4

0 に答える 0