Road Fuzzy Search
1. Import header files
#import <NavinfoKit/NavinfoKit.h>
2. Configure APIKEY
Refer to Project Configuration Instructions.
3. Define NavinfoTrafficRTICSearch
Define the traffic search object NavinfoTrafficRTICSearch and inherit the search protocol <NavinfoTrafficSearchDelegate >.
4. Construct NavinfoTrafficRTICSearch
Construct an event search object NavinfoTrafficRTICSearch and set the proxy.
_rticSearch = [NavinfoTrafficRTICSearch new]; _rticSearch.delegate = self;
5. Set the surrounding road fuzzy search query parameters
The request parameter class of the road fuzzy search query is NavinfoTrafficRoadNameQuery, and the keyword (keyword) is a mandatory parameter. For other non-essential parameters, please refer to the API documentation.
NavinfoTrafficRoadNameQuery *query = [NavinfoTrafficRoadNameQuery new]; Query.keyword = @"North"; query.cityName = @"beijing";
6. Initiate search query parameters
Initiate a road fuzzy search query by calling the roadNameSearch method of NavinfoTrafficRTICSearch.
[_rticSearch roadNameSearch:query];
7. Processing data in callbacks
Proxy method when the query is successful.
- (void)onTrafficRTICRoadNameSearch:(NavinfoTrafficRTICSearch * _Nonnull)rticSearch result:(NavinfoTrafficRoadNameResult * _Nullable)result error:(NSError * _Nullable)error;
where NavinfoTrafficRTICResult returns, NSError is nil, and the query result can be obtained at this time.
Description:
1) Get a road search instance via rticSearch.
2) Get the set of road names via result.roadNames.
- (void)onTrafficRTICRoadNameSearch:(NavinfoTrafficRTICSearch *)rticSearch result:(NavinfoTrafficRoadNameResult *)result error:(NSError *)error { NSLog(@"----> onTrafficRTICRoadNameSearch: %@", result.roadNames[0]); }
8. Processing failed queries
When the retrieval fails, Error returns, and the reason for the failure is obtained by the callback function.