Dummer CoreLocation Error...

  • Dummer CoreLocation Error...

    Quellcode

    1. Distance: 0.000000
    2. ERROR,Generic,Time,326390623.747,Function,"void CLClientHandleRegistrationTimerExpiry(__CFRunLoopTimer*, void*)",Registration timer expired, but client is still registering!


    Was heißt das und wie bekomme ich das weg? Google hat nix brauchbare ausgespuckt!

    lg, Reb00t
  • Gibts nicht viel:

    Quellcode

    1. userLoc = self.stationMapView.userLocation.location;
    2. double geoDataLatFloat = [geoDataLat doubleValue];
    3. double geoDataLngFloat = [geoDataLng doubleValue];
    4. CLLocationDistance distance = [userLoc distanceFromLocation:stationLoc];
    5. NSLog(@"Distance: %f", distance);


    Und ja, der Variablenname geoDataLat/LngFloat ist irreführend :D

    lg
  • Reb00t schrieb:

    Gibts nicht viel:

    Quellcode

    1. userLoc = self.stationMapView.userLocation.location;
    2. double geoDataLatFloat = [geoDataLat doubleValue];
    3. double geoDataLngFloat = [geoDataLng doubleValue];
    4. CLLocationDistance distance = [userLoc distanceFromLocation:stationLoc];
    5. NSLog(@"Distance: %f", distance);


    Und ja, der Variablenname geoDataLat/LngFloat ist irreführend :D

    lg

    Da der Fehler *nach* dem NSLog kommt, reicht der Codeschnipsel nicht um etwas dazu zu sagen. Und ob er überhaupt damit zu tun hat.

    -- hns
  • Das sind die Codezeilen, die dafür ausschlaggebend sind, weil ich die zusätzlich hinzugefügt habe!
    Ohne die Zeilen Code funktioniert es eh! Außerdem handelt es sich ja um eine CORELOCATION Error
    und diese Zeilen befassen sich nunmal damit. Zudem kommt nach NSLog nichts spektakuläres mehr...

    Aber der vollständigkeit halber nochmal die ganze Methode:

    Quellcode

    1. - (void)viewWillAppear:(BOOL)animated
    2. {
    3. userLoc = self.stationMapView.userLocation.location;
    4. NSError *error = nil;
    5. self.stationMapView = [[[MKMapView alloc] initWithFrame:self.view.bounds] autorelease];
    6. geoData = [NSString stringWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/maps/api/geocode/json?address=%@,+Oesterreich&sensor=true", [[VariableStore sharedInstance].stationName objectAtIndex:[[VariableStore sharedInstance].selectedCell intValue]]]] encoding:NSUTF8StringEncoding error:NULL];
    7. geoDataDictionary = [NSDictionary dictionaryWithJSONString:geoData error:&error];
    8. geoDataLat = [NSMutableString stringWithFormat:@"%@", [geoDataDictionary valueForKeyPath:[NSString stringWithFormat:@"results.geometry.location.lat", [[VariableStore sharedInstance].keyArray objectAtIndex:[[VariableStore sharedInstance].selectedCell intValue]]]]];
    9. geoDataLng = [NSMutableString stringWithFormat:@"%@", [geoDataDictionary valueForKeyPath:[NSString stringWithFormat:@"results.geometry.location.lng", [[VariableStore sharedInstance].keyArray objectAtIndex:[[VariableStore sharedInstance].selectedCell intValue]]]]];
    10. [geoDataLat deleteCharactersInRange:(NSRange){0,7}];
    11. NSRange matchLat = [geoDataLat rangeOfString:@"\""];
    12. NSInteger matchLocationLat = matchLat.location;
    13. NSInteger deleteFromLat = matchLocationLat - 1;
    14. NSInteger deleteToLat = [geoDataLat length] - deleteFromLat;
    15. [geoDataLat deleteCharactersInRange:(NSRange){deleteFromLat, deleteToLat}];
    16. [geoDataLng deleteCharactersInRange:(NSRange){0,7}];
    17. NSRange matchLng = [geoDataLng rangeOfString:@"\""];
    18. NSInteger matchLocationLng = matchLng.location;
    19. NSInteger deleteFromLng = matchLocationLng - 1;
    20. NSInteger deleteToLng = [geoDataLng length] - deleteFromLng;
    21. [geoDataLng deleteCharactersInRange:(NSRange){deleteFromLng, deleteToLng}];
    22. double geoDataLatFloat = [geoDataLat doubleValue];
    23. double geoDataLngFloat = [geoDataLng doubleValue];
    24. geoDataLat = nil;
    25. [geoDataLat release];
    26. geoDataLng = nil;
    27. [geoDataLng release];
    28. CLLocationCoordinate2D location;
    29. location.latitude = geoDataLatFloat;
    30. location.longitude = geoDataLngFloat;
    31. stationLoc = [[CLLocation alloc] initWithLatitude:location.latitude longitude:location.longitude];
    32. Annotation *anno = [[Annotation alloc] initWithUserLocation];
    33. [anno setCoordinate:location];
    34. [anno setTitle:[NSString stringWithFormat:@"%@", [[VariableStore sharedInstance].stationName objectAtIndex:[[VariableStore sharedInstance].selectedCell intValue]]]];
    35. [anno setSubtitle:[NSString stringWithFormat:@"%@%@", [[VariableStore sharedInstance].dataDictionary valueForKeyPath:[NSString stringWithFormat:@"%@.v", [[VariableStore sharedInstance].keyArray objectAtIndex:[[VariableStore sharedInstance].selectedCell intValue]]]], @" nSv/h"]];
    36. [self.stationMapView addAnnotation:anno];
    37. MKCoordinateSpan span;
    38. span.latitudeDelta = 0.10;
    39. span.longitudeDelta = 0.20;
    40. MKCoordinateRegion region;
    41. region.center = location;
    42. region.span = span;
    43. [self.stationMapView setRegion:region animated:YES];
    44. [self.stationMapView setCenterCoordinate:location animated:YES];
    45. self.stationMapView.userInteractionEnabled = false;
    46. [stationMapView selectAnnotation:[[stationMapView annotations]objectAtIndex:0] animated:YES];
    47. CLLocationDistance distance = [userLoc distanceFromLocation:stationLoc];
    48. NSLog(@"Distance: %f", distance);
    49. [self.view addSubview:self.stationMapView];
    50. }
    Alles anzeigen


    lg, Reb00t

    //EDIT:

    By the way: Weiß jemand, wie man die Sections in einer TableView handelt?
    Für jede Section, will ich die Daten aus einem NSMutableArray von x-y angezeigt haben.

    Bsp.:

    Section 1: 1-10
    Section 2: 11-20
    Section 3: 21-30

    usw.
  • Reb00t schrieb:

    Das sind die Codezeilen, die dafür ausschlaggebend sind, weil ich die zusätzlich hinzugefügt habe!
    Ohne die Zeilen Code funktioniert es eh! Außerdem handelt es sich ja um eine CORELOCATION Error
    und diese Zeilen befassen sich nunmal damit. Zudem kommt nach NSLog nichts spektakuläres mehr...
    Aber der vollständigkeit halber nochmal die ganze Methode:

    Quellcode

    1. Quellcode
    2. [self.view addSubview:self.stationMapView];


    Du kannst in der Methode nicht davon ausgehen, dass die View-Hierarchie etabliert ist.
    Den unspektakulären Aufruf solltest Du hier icht machen.
    I would be embarrassed if they did not spy on me.