Я пытаюсь получить название города текущего местоположения пользователя с помощью MKReverseGeoCoder, но в нем есть некоторые ошибки, которые я не могу распознать.Вот подробности:
Имеются некоторые ошибки, которые я не могу распознать
Undefined symbols:
".objc_class_name_CLLocationManager", referenced from:
literal-pointer@__OBJC@__cls_refs@CLLocationManager in mapViewController.o
"_kCLLocationAccuracyNearestTenMeters", referenced from:
_kCLLocationAccuracyNearestTenMeters$non_lazy_ptr in mapViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Вот мой код:
mapViewController.m
//
// mapViewController.m
// map
//
// Created by Ashutosh Tiwari on 7/23/10.
// Copyright ISU 2010. All rights reserved.
//
#import <MapKit/MapKit.h>
#import "mapViewController.h"
@implementation mapViewController
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
CLLocationManager *locationManager = [[[CLLocationManager alloc] init] autorelease];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
[locationManager startUpdatingLocation];
[super viewDidLoad];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate];
geoCoder.delegate = self;
[geoCoder start];
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSLog(@"locationManager:%@ didFailWithError:%@", manager, error);
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
MKPlacemark * myPlacemark = placemark;
NSString *kABPersonAddressCityKey;
NSString *city = [myPlacemark.addressDictionary objectForKey:(NSString*) kABPersonAddressCityKey];
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
{
NSLog(@"reverseGeocoder:%@ didFailWithError:%@", geocoder, error);
}
- (void)dealloc {
[super dealloc];
}
@end