Track Correction
1. Import header files
#import <NavinfoKit/NavinfoKit.h>
2. Configure APIKEY
Refer to Project Configuration Instructions.
3. Define NavinfoRouteMatch
Define the main track correction object NavinfoRouteMatch and inherit the search protocol <NavinfoRouteMatchQueryDelegate>.
4. Construct NavinfoRouteMatch
Construct the main search object NavinfoRouteMatch and set the proxy.
NavinfoRouteMatch * routeMatch = [[NavinfoRouteMatch alloc] init]; routeMatch.delegate = self;
5. Set the starting trajectory correction parameter
The request parameter class of the track correction query is NavinfoRouteMatchQuery, which quickly constructs the NavinfoRouteMatchQuery method. Required parameters Guid (device id), source (device source), type (input coordinate type), gpsInfos (GPS information array). For other non-essential parameters, please refer to the API documentation.
- (id)initWithGuid:(NSString *)guid source:(NSString *)source inGbType:(NavinfoGbType)type gpsInfos:(NSArray <NavinfoGpsInfo*> *)gpsInfos;
6. Initiate track correction request
Initiate a calculation query by calling the startMatch method of NavinfoRouteMatch.
[routeMatch startMatchWith:matchQuery];
7. Processing data in callbacks
When the query is successful, it will enter the callback function, and the callback function can get the result of the calculation.
Description:
Get a driving and transfer plan set via response.routes.
- (void)onRouteMatchResul:(NavinfoRouteMatch * _Nonnull)routeSearch response:(NavinfoRouteMatchResult * _Nullable)response error:(NSError * _Nullable)error;
8. Processing a failed query When the retrieval fails, Error returns, and the reason for the failure is obtained by the callback function.
- (void)onRouteMatchResul:(NavinfoRouteMatch * _Nonnull)routeSearch response:(NavinfoRouteMatchResult * _Nullable)response error:(NSError * _Nullable)error{ NSLog(@"Error: %@", error); }