2012-06-21 3 views
0

J'ai donc développé une application de boussole autonome (flèche tournant pour pointer un point lat/long) qui fonctionne parfaitement comme un projet autonome mais quand je suis venu l'incorporer dans le projet plus large avoir un problèmeTypes de pointeurs incompatibles assignés à CLLocationManager

Au début, je reçois un avertissement sémantique (types pointeur Incompatible attribuant à « CLLocationManager * » de « CLLoccation * __ fort ») pour:

- (void)locationManager:(CLLocationManager *)manager 
didUpdateToLocation:(CLLocation *)newLocation 
     fromLocation:(CLLocation *)oldLocation { 

if (newLocation.horizontalAccuracy >= 0) { 

    self.recentLocation = newLocation; (WARNING HERE) 

CLLocation *POI2location = [[CLLocation alloc] 
           initWithLatitude:kPOI2Latitude 
           longitude:kPOI2Longitude]; 
    CLLocationDistance delta = [POI2location 

           distanceFromLocation:newLocation]; 

Et plus loin, je reçois une erreur fatale (la propriété « coordonne » non trouvé sur l'objet de type « CLLocationManager) pour:

- (void)locationManager:(CLLocationManager *)manager 
    didUpdateHeading:(CLHeading *)newHeading { 

if (self.recentLocation != nil && newHeading.headingAccuracy >= 0) { 
    CLLocation *POI2Location = [[CLLocation alloc] 
           initWithLatitude:kPOI2Latitude 
           longitude:kPOI2Longitude]; 

    double course = [self headingToLocation:POI2Location.coordinate 
            current:recentLocation.coordinate]; (WARNING HERE) 

pour une raison quelconque, il n'aime pas « recentLocation » maintenant alors qu'il était tout fonctionne parfaitement avant. Quelqu'un peut-il me signaler ce qui me manque? Je suis sûr que c'est évident pour quelqu'un qui a plus d'expérience que moi.

Un grand merci à l'avance.

Répondre

0

Commencé à nouveau ce matin et la réponse me regarde dans le visage!

Dans le fichier .h je mettrais

@property (strong, nonatomic) CLLocationManager *recentLocation; 

quand je aurais dû mettre

@property (strong, nonatomic) CLLocation *recentLocation; 
Questions connexes