Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone MKReverseGeocoder未正确响应_Iphone_Mkmapview_Mkreversegeocoder - Fatal编程技术网

Iphone MKReverseGeocoder未正确响应

Iphone MKReverseGeocoder未正确响应,iphone,mkmapview,mkreversegeocoder,Iphone,Mkmapview,Mkreversegeocoder,我正在我的应用程序中使用地图工具包。。。。我正试图在一个特定的位置放置placemark。。。。但是地理编码器没有正确响应。。。。 代码如下: 地图.h 它给出了什么错误描述可能是您过早地释放了reverseGeocoder。。请参考此问题。。。我试过了,但还是犯了同样的错误。。。。我没有发布任何geocoderOne更多的查询,如何使用MPMAPKIT搜索当前位置和其他位置之间的距离。。我自己没用过。。我曾经解析来自google的JSON响应来实现这一点。 #import <UIKit/

我正在我的应用程序中使用地图工具包。。。。我正试图在一个特定的位置放置placemark。。。。但是地理编码器没有正确响应。。。。 代码如下: 地图.h


它给出了什么错误描述可能是您过早地释放了reverseGeocoder。。请参考此问题。。。我试过了,但还是犯了同样的错误。。。。我没有发布任何geocoderOne更多的查询,如何使用MPMAPKIT搜索当前位置和其他位置之间的距离。。我自己没用过。。我曾经解析来自google的JSON响应来实现这一点。
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <MapKit/MKAnnotation.h>
#import <MapKit/MKReverseGeocoder.h>

@interface Map : UIViewController <MKMapViewDelegate,MKReverseGeocoderDelegate>
{
    MKMapView *map;
    MKReverseGeocoder *geoCoder;
    MKPlacemark *mPlacemark;
    IBOutlet UISegmentedControl *mapType;
  }
- (IBAction)changeType:(id) sender;
@end
     #import "Map.h"

@implementation Map

 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    map=[[MKMapView alloc]initWithFrame:CGRectMake(0, 40, 320, 379)];

    map.delegate=self;
    map.showsUserLocation=TRUE;
    map.mapType=MKMapTypeStandard; 
      /*Location*/
    MKCoordinateRegion region;
    MKCoordinateSpan span;
    span.latitudeDelta=0.9;
    span.longitudeDelta=0.9;

    CLLocationCoordinate2D location=map.userLocation.coordinate;

    location.latitude=45.08568;
    location.longitude=77.000;
    region.span=span;
    region.center=location;
    /*Geocoder Stuff*/

    geoCoder=[[MKReverseGeocoder alloc] initWithCoordinate:location];
    geoCoder.delegate=self;
    [geoCoder start];


    [map setRegion:region animated:TRUE];
    [map regionThatFits:region];
    [self.view insertSubview:map atIndex:0];      
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
- (void)viewDidUnload
{

    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
{
    NSLog(@"%@Reverse Geocoder Errored",[error description]);
    [geoCoder autorelease];
    [geoCoder setDelegate:nil];

}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark{
    NSLog(@"Reverse Geocoder completed");
    mPlacemark=placemark;
    [map addAnnotation:placemark];
}

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
    MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
    annView.animatesDrop=TRUE;
    return annView;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
Error Domain=NSURLErrorDomain Code=-1011 "The operation couldn’t be completed. (NSURLErrorDomain error -1011.)" UserInfo=0x5a36270 {PBHTTPStatusCode=503}Reverse Geocoder Errored