gpt4 book ai didi

ios - MKMapView 未在 mapType MKMapTypeStandard 和 MKMapTypeHybrid 上加载

转载 作者:可可西里 更新时间:2023-11-01 03:34:10 25 4
gpt4 key购买 nike

我正在开发一个必须加载 3 种不同 map 类型的应用程序。

  1. MKMapType标准
  2. MKMapTypeHybrid。
  3. MKMapTypeSatellite。

MKMapTypeSatellite 工作正常,但在 MKMapTypeStandard 和 MKMapTypeHybrid 中加载 map 时。它调用以下委托(delegate)方法

- (void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error;

它给我以下错误。

UserInfo={SimpleTileRequesterUnderlyingErrors=( “错误域=GEOErrorDomain 代码=-204\”(空)\“用户信息={HTTPStatus=410,NSErrorFailingURLStringKey= http://gspe19.ls.apple.com/tile.vf?flags=1&style=1&size=2&scale=0&v=11043961&z=12&x=660&y=1590&sid=1311957767904651942802757092322405105280&accessKey=1462435981_hSWhfZAWqY7wbLSz_6yKz632EUigAIfHlARfHz5OZnObk4SFpRyFZH9qim7suxznqeD333wldHPDaCADTpx1hD98l55WMoqg6qjh2BMyZtDwLayiLzpSWLxfuYD4Oi%2BI3wB%2BGvMwttokk5y8UlnR1E68zLU6KuXF4MWLKLhvv%2F6utSC8RDmorsQksacSTvCwYc45PeV5ba%2Fjvt2d3 }”...

我正在切换 map 类型

-(IBAction)valuechange:(id)sender{
switch (((UISegmentedControl *) sender).selectedSegmentIndex) {
case 0:
_mapView.mapType = MKMapTypeStandard ;
break;

case 1:
_mapView.mapType = MKMapTypeSatellite ;
break;

case 2:
_mapView.mapType = MKMapTypeHybrid ;
break;

default:
break;
}

enter image description here enter image description here enter image description here

更新:我想我有类似的问题 MKMapView fails to load tiles with HTTP 410 error

当我重新启动模拟器时。现在 map 加载完美。同样,我的客户告诉我,如果他在他的设备 map 上终止应用程序,则可以完美加载。但是每个新加载的应用程序都有这个问题。我现在很沮丧。 :(

最佳答案

此代码对我有用。如果您有一些修改,请查看下方。

- (void)viewDidLoad {

[super viewDidLoad];

mapView = [[MKMapView alloc]initWithFrame:
CGRectMake(10, 100, 300, 300)];
mapView.delegate = self;
mapView.centerCoordinate = CLLocationCoordinate2DMake(37.32, -122.03);
mapView.mapType = MKMapTypeHybrid;
CLLocationCoordinate2D location;
location.latitude = (double) 37.332768;
location.longitude = (double) -122.030039;

// Add the annotation to our map view
MapAnnotation *newAnnotation = [[MapAnnotation alloc]
initWithTitle:@"MKMapTypeHybrid" andCoordinate:location];
[mapView addAnnotation:newAnnotation];
CLLocationCoordinate2D location2;
location2.latitude = (double) 37.35239;
location2.longitude = (double) -122.025919;
MapAnnotation *newAnnotation2 = [[MapAnnotation alloc]
initWithTitle:@"MKMapTypeHybrid" andCoordinate:location2];
[mapView addAnnotation:newAnnotation2];
[self.view addSubview:mapView];

}


// When a map annotation point is added, zoom to it (1500 range)
- (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views
{

MKAnnotationView *annotationView = [views objectAtIndex:0];
id <MKAnnotation> mp = [annotationView annotation];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance
([mp coordinate], 1500, 1500);
[mv setRegion:region animated:YES];
[mv selectAnnotation:mp animated:YES];

}

只需更改值mapView.mapType = MKMapTypeStandard;

MKMapTypeStandard、MKMapTypeHybrid & MKMapTypeSatellite

如果你想查看,我也发布了图片。

MKMapTypeHybrid

MKMapTypeSatellite

MKMapTypeStandard

关于ios - MKMapView 未在 mapType MKMapTypeStandard 和 MKMapTypeHybrid 上加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37046618/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com