2012-10-01 31 views
0

在我的應用程序中某處,我想使用「用戶位置」。我找到了下面的代碼。但是,我收到了「財產」地點「和」代理人未找到「錯誤。應用程序變得越來越複雜,我似乎無法找到解決方案。我是xcode和objective-c的新手。那麼你能幫我解決嗎? 這裏是代碼:核心位置 - 未找到物業「位置」

-(void)getUserLocation{ 

self.geoCoder = [[CLGeocoder alloc] init]; 
self.locationMng = [[CLLocationManager alloc]init]; 
locationMng.delegate = self; 

[self.geoCoder reverseGeocodeLocation: locationMng.location completionHandler: 
^(NSArray *placemarks, NSError *error) { 


    CLPlacemark *placemark = [placemarks objectAtIndex:0]; 


    NSString *locatedAt = [[placemark.addressDictionary valueForKey:@"FormattedAddressLines"] componentsJoinedByString:@", "]; 


    NSLog(@"I am currently at %@",locatedAt); 


    [locationLabel setText:locatedAt]; 

}]; 

} 

在此先感謝您!

+0

你導入'#進口'在這個文件? – Nekto

+0

@nekto是的,那是我檢查的第一件事。 – blackie

+0

你是怎麼聲明'locationMng'的? – Nekto

回答

0

正如從評論中可以看出,您已經錯誤地聲明瞭屬性locationMng

試試這個:

@property (retain, nonatomic) CLLocationManager *locationMng;