Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.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
文本说明不';在导航模式(Mapbox iOS)下不显示_Ios_Objective C_Mapbox - Fatal编程技术网

文本说明不';在导航模式(Mapbox iOS)下不显示

文本说明不';在导航模式(Mapbox iOS)下不显示,ios,objective-c,mapbox,Ios,Objective C,Mapbox,在导航模式下,step指令文本不会显示(就我测试而言,口头指令也不会显示)。以下是获取路线时调用的函数: - (void)startNavigation:(MBRoute *)route { MBNavigationLocationManager *locationManager = [[MBNavigationLocationManager alloc] init]; MBNavigationViewController *controller = [[MBNavigationViewCont

在导航模式下,step指令文本不会显示(就我测试而言,口头指令也不会显示)。以下是获取路线时调用的函数:

- (void)startNavigation:(MBRoute *)route {
MBNavigationLocationManager *locationManager = [[MBNavigationLocationManager alloc] init];
MBNavigationViewController *controller = [[MBNavigationViewController alloc] initWithRoute:route directions:[MBDirections sharedDirections] style:nil locationManager:locationManager];
[self presentViewController:controller animated:YES completion:^{ NSString *locationURL = [NSString stringWithFormat:@"https://DBNAME.firebaseio.com/realtime-location"];
    FIRDatabaseReference *geofireRef = [[FIRDatabase database] referenceFromURL:locationURL];
    GeoFire *geoFire = [[GeoFire alloc] initWithFirebaseRef:geofireRef];
    CLLocation *center = [[CLLocation alloc] initWithLatitude:self.currentLocation.coordinate.latitude longitude:self.currentLocation.coordinate.longitude];
    GFCircleQuery *circleQuery = [geoFire queryAtLocation:center withRadius:1.0];
    FIRDatabaseHandle queryEntered = [circleQuery observeEventType:GFEventTypeKeyEntered withBlock:^(NSString *key, CLLocation *location) {
        if (![key isEqualToString:self.carID]) {
            for (MGLPointAnnotation *annotation in controller.mapView.annotations) {
                if ([annotation.title isEqualToString:key]) {
                    break;
                } else {
                    MGLPointAnnotation *point = [[MGLPointAnnotation alloc] init];
                    point.coordinate = location.coordinate;
                    point.title = key;
                    [controller.mapView addAnnotation:point];
                    NSLog(@"Added new surrounding annotation %@", key);
                }
            }
        }
    }];

    FIRDatabaseHandle queryMoved = [circleQuery observeEventType:GFEventTypeKeyMoved withBlock:^(NSString *key, CLLocation *location) {
        if (![key isEqualToString:self.carID]) {
            for (MGLPointAnnotation *annotation in controller.mapView.annotations) {
                if ([annotation.title isEqualToString:key]) {
                    [controller.mapView removeAnnotation:annotation];

                    MGLPointAnnotation *point = [[MGLPointAnnotation alloc] init];
                    point.coordinate = location.coordinate;
                    point.title = key;
                    [controller.mapView addAnnotation:point];
                    NSLog(@"Updated surrounding annotations %@", key);
                }
            }
        }
    }];
}];

self.navController = controller;
UIButton *cautionButton = [UIButton buttonWithType:UIButtonTypeCustom];
cautionButton.frame = CGRectMake(3, self.view.frame.size.height-122, 45, 39);
UIImage *buttonImage = [UIImage imageNamed:@"caution"];
[cautionButton setImage:buttonImage forState:UIControlStateNormal];
[cautionButton addTarget:self action:@selector(reportCaution) forControlEvents:UIControlEventTouchUpInside];
[controller.view addSubview:cautionButton];
}

截图:

以下是我正在使用的与Mapbox相关的POD的版本。据我所知,它们是最新的版本:

 - Mapbox-iOS-SDK (3.7.2)
  - MapboxCoreNavigation (0.12.0):
    - MapboxDirections.swift (~> 0.15)
    - MapboxMobileEvents (~> 0.2)
    - Turf (~> 0.0.4)
  - MapboxDirections.swift (0.15.1):
    - Polyline (~> 4.2)
  - MapboxMobileEvents (0.2.10)
  - MapboxNavigation (0.12.0):
    - AWSPolly (~> 2.6)
    - Mapbox-iOS-SDK (~> 3.6)
    - MapboxCoreNavigation (= 0.12.0)
    - SDWebImage (~> 4.1)
    - Solar (~> 2.1)
    - Turf (~> 0.0.4)
  - Masonry (1.1.0)
  - MBProgressHUD (0.9.2)

通过更改calculateDirectionsWithOptions的路由选项(我已经有includeSteps=YES)修复了此问题:

options.includesSpokenInstructions = YES;
options.includesVisualInstructions = YES;