2012-06-21 42 views
0

所以我開發了一個獨立的指南針應用程序(箭頭指向固定緯度/長點),它完美地作爲一個獨立的項目工作,但是當我將它合併到更廣泛的項目中時I出現問題。分配給CLLocationManager的不兼容指針類型

起初我得到一個語義警告(不兼容的指針類型從分配給「CLLocationManager *」「CLLoccation * __強」)爲:

- (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]; 

進一步對我得到一個致命錯誤(物業「座標」不在類型的對象中找到「CLLocationManager)爲:

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

出於某種原因,它不喜歡‘recentLocation’現在,而這一切都是可以正常使用了。有人能向我指出我錯過了什麼嗎?我相信,對於比我更有經驗的人來說,這是顯而易見的。

非常感謝提前。

回答

0

今天早上再次開始,答案正在凝視着我!

在.h文件我會把

@property (strong, nonatomic) CLLocationManager *recentLocation; 

時,我應該已經把

@property (strong, nonatomic) CLLocation *recentLocation; 
相關問題