here-ios-sdk-examples icon indicating copy to clipboard operation
here-ios-sdk-examples copied to clipboard

Delegate NMAManagerDelegate

Open RapsusMTN opened this issue 6 years ago • 18 comments

Hi, in your Example GuidanceApp the NavigationManager doesn´t call the NMAManagerDelegate when start the simulated route, I describe the steps below:

  • In the info.plist file I have added the Privacy - Location When In Use Usage Description permission
  • I have set the delegate in the viewDidLoad.
  • I am doing the tests in the Xcode simulator.
  • The route starts and is drawn correctly but the delegate is not called

Attached route start image: image

I await your solution, greetings!!!

RapsusMTN avatar Jul 24 '19 11:07 RapsusMTN

Hi @RapsusMTN, I can not reproduce it in turn-by-turn-navigation(GuidanceApp) project. I tried both Swift and Objective-C examples, as well as real device + Simulator. Following callback gets triggered when new maneuver is available:

- (void)navigationManager:(nonnull NMANavigationManager*)navigationManager
           hasCurrentManeuver:(nullable NMAManeuver *)currentManeuver
                      nextManeuver:(nullable NMAManeuver *)nextManeuver
NS_SWIFT_NAME(navigationManager(_:didUpdateManeuvers:_:));

Which callback of NMANavigationManagerDelegate are you listening to?

Note, navigationManagerDidFindPosition is not called on position update. If tracking position updates needed, use NMAPositioningManager. Check this comment.

dashchak avatar Jul 24 '19 12:07 dashchak

The language I am using is Swift, I am only implementing the NMAManagerDelegate protocol and calling different functions of it. I am not using Notification Center may the problem be not using this? Although it should also work only by calling the delegate?

Thanks!:)

RapsusMTN avatar Jul 24 '19 13:07 RapsusMTN

You should not call functions of NMANavigationManagerDelegate Protocol. The idea is to pass your class object as a delegate to nav manager and implement nav manager protocol functions in your class. Those functions will be triggered once nav manager has some changes. Notification Center is not needed in this case.

The following steps should work:

  1. Download Guidance project
  2. Run "pod install".
  3. Open GuidanceApp.xcworkspace.
  4. Set your credentials in AppDelegate.swift (appId, appCode, licenseKey).
  5. Set your Bundle Identifier in Target Settings, General tab.
  6. Add breakpoint at showMessage("New maneuver is available") ( MainViewController:228)
  7. Run the app, press Start Navigation and select Simulation.
  8. Wait until app running stops on breakpoint.

Please share your sample code, if you have any questions.

dashchak avatar Jul 24 '19 14:07 dashchak

Ok, I tried the example project and compared it with mine and the problem is in the following question: When I create the NMARoutingMode object and enter the transportMode .bike parameter, the call to the delegate is not made, however if I enter it as a .car parameter, if it calls it, should I use another protocol to track the bike routes? Thanks!

RapsusMTN avatar Jul 24 '19 15:07 RapsusMTN

The protocol must be the same as for other transport types. Indeed, I was able to reproduce it only with bike transport type. Looking for root cause. Thanks!

dashchak avatar Jul 24 '19 15:07 dashchak

One more question. Is there a lot of difference between changing the parameter from car to bike transport type? Thanks!

RapsusMTN avatar Jul 25 '19 14:07 RapsusMTN

Yes, there are roads forbidden for bikes but allowed for cars. And vice versa. Thus creating route and its Navigation is done considering the transport mode. Also, time to arrival will not be the same for different transport types.

dashchak avatar Jul 25 '19 15:07 dashchak

Okay thank you, I still cannot make a simulated route with the bike parameter, I tried to reduce the simulation speed of the vehicle in case the one I had set was too high, but the NMANavigationManagerDelegate is not called, only with the car parameter.

RapsusMTN avatar Jul 25 '19 15:07 RapsusMTN

Please make sure your license key has SDK-Navigation-Bike feature enabled. Otherwise, bike navigation will not work as expected.

Check your console output for errors:

_obfuscated_checkLicenseKeys - Bike Navigation denied
[NMANavigationManager navigationErrorForRoute:] - ERROR: there is no authentication to use turn by turn navigation

dashchak avatar Jul 30 '19 11:07 dashchak

Okey , How do I see if my license has permission to use bike navigation?? my navigation starts normally but the delegate is not called when entering the parameter .bike, and my console is clean! Thanks!

RapsusMTN avatar Jul 30 '19 11:07 RapsusMTN

Freemium Plan does not include SDK-Navigation-Bike feature. If it is PRO, you can check feature list on https://developer.here.com Or you can share you app_id and I can double check the feature list.

dashchak avatar Jul 30 '19 11:07 dashchak

My app_ID is MH2cf8mztYGyJMC9Yrlm.

RapsusMTN avatar Jul 30 '19 12:07 RapsusMTN

Unfortunately your feature list is missing SDK-Navigation-Bike. Looks like you have Freemium Plan features only. For more features you need to switch to PRO plan.

By the way, startTurnByTurnNavigationWithRoute should return NMANavigationErrorOperationNotAllowed error code.

Thanks!

dashchak avatar Jul 30 '19 12:07 dashchak

Ok, but I can't pay the premium without having tried the bike route functionality. The error is not released by console Greetings

RapsusMTN avatar Jul 30 '19 12:07 RapsusMTN

I understand. I will check if it is possible to included this feature in Freemium Plan by default.

Regarding NMANavigationErrorOperationNotAllowed error, I meant NSError as a return type:

- (nullable NSError *)startTurnByTurnNavigationWithRoute:(nonnull NMARoute*)route

For instance for prohibited Bike navigation:

NSError *error = [self.navigationManager startTurnByTurnNavigationWithRoute:self.route];
NSLog(@"%@", error);

Should output: GuidanceApp[3920:799350] Error Domain=NMANavigationManager Code=9 "(null)"

Which is NMANavigationErrorOperationNotAllowed error. I will update Github samples to check for start navigation errors.

dashchak avatar Jul 30 '19 14:07 dashchak

One more thing. Bike navigation does not start due to returned error, that's why you don't get callbacks. Voice guidance is off as well. What's actually happens is just route simulation with mapTrackingEnabled.

Try to create one route, add it to map and use it for startTurnByTurnNavigationWithRoute. Whereas create another route(don't add it to the map) and pass it to dataSource. As a result simulation will be done for second route which is not added to the map.

dashchak avatar Jul 30 '19 14:07 dashchak

Perfect, I tried to capture the startTurnByTurn error and it doesn't throw any error when using bike as a parameter. So if you can check it would be appreciated, We are a company that we are dedicated to the bicycle sector and we would be interested in buying the premium to develop our mobile application. If you can provide us with this test feature, it would be perfect, because we will surely buy the premium. Greetings

RapsusMTN avatar Jul 31 '19 08:07 RapsusMTN

Regarding navigation error capture, please see my recent changes.

Bike navigation is beta feature and was not officially announced for all customers yet. I created a request to HERE management to include it to Freemium Plan. I will notify you about the decision.

dashchak avatar Jul 31 '19 11:07 dashchak