标签: mkreversegeocoder

cllocation和mkreversegeocoder

我试图用cllocation和mkreversegeocoder来修改城市名称.在我的viewdidload方法我istance cllocationmanager:

self.locManager = [[CLLocationManager alloc] init];
locManager.delegate = self;
locManager.desiredAccuracy = kCLLocationAccuracyBest;
[locManager startUpdatingLocation];
Run Code Online (Sandbox Code Playgroud)

之后:

- (void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation 
*)newLocation
fromLocation:(CLLocation *)oldLocation {
//some code to retrieve my information

MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc]     
initWithCoordinate:newLocation.coordinate ];
geoCoder.delegate = self;
[geoCoder start];
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark  
*)placemark
{
MKPlacemark *myPlacemark = placemark;
citta.text = [placemark locality];
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error{
citta.text =@ "Unknow";
Run Code Online (Sandbox Code Playgroud)

应用程序仅在我第一次获得我的价值时起作用.在第二次应用程序崩溃.我认为是因为地理编码器已启动,我认为我必须只有一个运行.(但我真的不是这个......).在哪种方式我可以控制地理编码器正在运行?

我已经看到我可以使用cllocationcoordinate2d在我的viewdidload中使用mkreversegeocoder但是...以这种方式我可以检索newlocation.coordinate?

我已经部分解决了将地理编码器声明为类变量并进行检查的问题

if (self.geocoder != nil) {
   [geocoder release];
}
Run Code Online (Sandbox Code Playgroud)

但是....如果在我的

- …
Run Code Online (Sandbox Code Playgroud)

iphone cllocationmanager cllocation mkreversegeocoder

3
推荐指数
1
解决办法
9177
查看次数

iPhone - MKReverseGeocoder.adminstrativeArea - 获取州名缩写

在MKReverseGeocoder的文档中,administrativeArea属性为您提供了用户所处的当前状态,并在示例中提到它返回EITHER状态名称或其缩写.我想知道是否有人知道如何获得缩写而不是完整的州名...我已经找不到任何表明这甚至可能除了那个简单的例子之外没有提及如何.

谢谢!

iphone mkreversegeocoder

2
推荐指数
1
解决办法
1249
查看次数

使用CLLocationManager和MKReverseGeocoder获取城市名称

我试图通过使用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
Run Code Online (Sandbox Code Playgroud)

在这里;我的代码:

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]; …
Run Code Online (Sandbox Code Playgroud)

objective-c mkmapview cllocationmanager mkreversegeocoder

2
推荐指数
1
解决办法
7043
查看次数

从纬度和经度获取位置地址

我正在开发一个应用程序,我必须显示给定纬度和经度的地址.我有纬度和经度,但我不知道如何从经纬度获取我的地址.任何建议将非常感谢提前感谢!

iphone objective-c mkmapview mkreversegeocoder

1
推荐指数
1
解决办法
3959
查看次数

在xcode中反向地理编码

我正在制作一个应用程序,它会占用您当前的位置并确定您所在州的税收.因此,我需要使用反向地理编码.我在这个网站上找到了一些教程和类似的问题,但我没有发现任何与xcode有关的内容,也没有过时,并告诉我我需要做什么(不仅仅是api).如果有人可以帮助我,即使只是给我一个很好的教程的链接,我将不胜感激

xcode mkreversegeocoder

1
推荐指数
1
解决办法
2161
查看次数

MKReverseGeocoder"在iOS 5中弃用"

它说它"在iOS 5中被弃用".

- (void)viewDidLoad {
    [super viewDidLoad];
    CLGeocoder *geocoder = [[CLGeocoder alloc] init];

    [geocoder reverseGeocodeLocation:self.locationManager.location // You can pass aLocation here instead
                   completionHandler:^(NSArray *placemarks, NSError *error) {

                 dispatch_async(dispatch_get_main_queue() , ^ {
                           // do stuff with placemarks on the main thread

                           CLPlacemark *place = [placemarks objectAtIndex:0];

                           NSString *zipString = [place.addressDictionary valueForKey:@"ZIP"];

                           [self performSelectorInBackground:@selector(showWeatherFor:) withObject:zipString];



                       }
            }
 }
Run Code Online (Sandbox Code Playgroud)

iphone xcode mkreversegeocoder ios

0
推荐指数
1
解决办法
6299
查看次数