ArcGIS を使用して現在地を取得するロケーション サービスに問題があります。コードの一部は次のとおりです。
-(void)viewDidLoad {
[super viewDidLoad];
[self.activityView startAnimating];
//self.mapView.layerDelegate = self;
self.mapView.touchDelegate = self;
self.mapView.calloutDelegate = self;
NSURL *mapUrl = [NSURL URLWithString:kTiledMapServiceURL];
AGSTiledMapServiceLayer *tiledLyr = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:mapUrl];
[self.mapView addMapLayer:tiledLyr withName:@"Tiled Layer"];
//Create Bus Graphic layer
AGSGraphicsLayer *busGraphicLayer = [AGSGraphicsLayer graphicsLayer];
[self.mapView addMapLayer:busGraphicLayer withName:@"BusLayer"];
//Create Graphic layer
AGSGraphicsLayer *graphicLayer = [AGSGraphicsLayer graphicsLayer];
[self.mapView addMapLayer:graphicLayer withName:@"GraphicsLayer"];
//Create Service layer
AGSGraphicsLayer *serviceLayer = [AGSGraphicsLayer graphicsLayer];
[self.mapView addMapLayer:serviceLayer withName:@"ServiceLayer"];
//Create Path layer
AGSGraphicsLayer *pathLayer = [AGSGraphicsLayer graphicsLayer];
[self.mapView addMapLayer:pathLayer withName:@"PathLayer"];
}
- (void) showMarkingOnMap:(Service *) ser
{
id<AGSLayerView> graphicsLayerView = [self.mapView.mapLayerViews objectForKey:@"ServiceLayer"];
AGSGraphicsLayer *graphicsLayer = (AGSGraphicsLayer*)graphicsLayerView.agsLayer;
[graphicsLayer removeAllGraphics];
// Create a symbols png graphic
AGSPictureMarkerSymbol *genSymbol = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:@"pushpin.png"];
ServiceInfoTemplate *infoTemplate = [[ServiceInfoTemplate alloc] init];
AGSGraphic *genGraphic;
AGSPoint *genPt;
NSMutableDictionary *dic= [[NSMutableDictionary alloc] init];
[dic setObject:[ser name] forKey:@"NAME"];
if([ser.location isEqualToString: @"\n"] || (ser.location == nil)){
[dic setObject:@"" forKey:@"DESC"];
} else {
[dic setObject:[ser location] forKey:@"DESC"];
}
genPt = [AGSPoint pointWithX:[[ser xcoordinate] floatValue]
y:[[ser ycoordinate] floatValue]
spatialReference:self.mapView.spatialReference];
destinationX = [[ser xcoordinate] floatValue];
destinationY = [[ser ycoordinate] floatValue];
genGraphic = [[AGSGraphic alloc] initWithGeometry:genPt symbol:genSymbol attributes:dic infoTemplateDelegate:infoTemplate];
[graphicsLayer addGraphic:genGraphic];
[graphicsLayer dataChanged];
[self.mapView zoomWithFactor:0.1 atAnchorPoint:CGPointMake(destinationX, destinationY) animated:NO];
[self.mapView centerAtPoint:genPt animated:YES];
}
このメソッドは、現在の場所を呼び出した場所です
- (IBAction) directionAction:(id)sender{
NSString *format = [NSString stringWithFormat:@"http://www....&routeStops=%f,%f;%f,%f&routemode=DRIVE&avoidERP=0"",
self.mapView.gps.currentPoint.x, self.mapView.gps.currentPoint.y, destinationX, destinationY];
}
これself.mapView.gps.currentPoint.x
は私に0を返しますが、私がいる現在のx座標を返すことになっています。誰がそれの何が悪いのか知っていますか?