RTIC Broadcast
Road Traffic Reports
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 road traffic search query parameters
The request parameter class for road traffic search query is NavinfoTrafficRoadQuery, and the roadName cityName is two required parameters.
Please refer to the API documentation for other parameters.
NavinfoTrafficRoadQuery *query = [NavinfoTrafficRoadQuery new]; query.roadName = @"XiAn Road"; query.cityName = @"Dalian";
6. Initiate search query parameters
Initiate a road traffic search query by calling the roadRTICSearch method of NavinfoTrafficRTICSearch.
[_rticSearch roadRTICSearch:query];
7. Processing data in callbacks
Proxy method when the query is successful.
- (void)onTrafficRTICRoadSearch:(NavinfoTrafficRTICSearch * _Nonnull)rticSearch result:(NavinfoTrafficRTICResult * _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 number of traffic information via totalCount.
3) Get the traffic details collection via contents.
- (void)onTrafficRTICRoadSearch:(NavinfoTrafficRTICSearch *)rticSearch result:(NavinfoTrafficRTICResult *) result error:(NSError *) error { NSLog(@"----> onTrafficRTICRoadSearch: total=%ld, contents=%@",(long)result.totalCount, result.contents[0].rticInfo); }
8. Processing failed queries
When the retrieval fails, Error returns, and the reason for the failure is obtained by the callback function.
Front Traffic Reports
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 front traffic search query parameters
The request parameter class for the front traffic search query is NavinfoTrafficFrontQuery, and the lonlats (latitude and longitude string) is a mandatory parameter.
Please refer to the API documentation for other non-essential parameters.
NavinfoTrafficFrontQuery *query = [NavinfoTrafficFrontQuery new]; query.lonlats = @[[[NavinfoLonlat alloc] initWith:11635646 latitude:3992317 gbType:NavinfoGbTypeG02]]; query.direction = 270;
6. Initiate search query parameters
Initiate a forward traffic search query by calling the frontRTICSearch method of NavinfoTrafficRTICSearch.
[_rticSearch frontRTICSearch:query];
7. Processing data in callbacks
Proxy method when the query is successful.
- (void)onTrafficRTICFrontSearch:(NavinfoTrafficRTICSearch * _Nonnull)rticSearch result:(NavinfoTrafficRTICResult * _Nullable)result error:(NSError * _Nullable)error;
where NavinfoTrafficRTICResult returns, NSError is nil, and the query result can be obtained at this time.
For the parameter information, please refer to [Road Traffic Voice Broadcast].
- (void)onTrafficRTICFrontSearch:(NavinfoTrafficRTICSearch *)rticSearch result:(NavinfoTrafficRTICResult *)result error:(NSError *)error { NSLog(@"----> onTrafficRTICFrontSearch: total=%ld, contents=%@",(long)result.totalCount, result.contents[0].rticInfo); }
8. Processing failed queries
When the retrieval fails, Error returns, and the reason for the failure is obtained by the callback function.
Nearby Traffic Reports
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 traffic search query parameters
The request parameter class for the surrounding traffic search query is NavinfoTrafficAroundQuery, poiName (POI name) and lonlat (latitude and longitude coordinates) cannot be empty at the same time.
Please refer to the API documentation for other non-essential parameters.
NavinfoTrafficAroundQuery *query = [NavinfoTrafficAroundQuery new]; query.poiName = @"Peking University"; query.lonlat = [[NavinfoLonlat alloc] initWith:11635646 latitude:3992317 gbType:NavinfoGbTypeG02];
6. Initiate search query parameters
Initiate a peripheral traffic search query by calling the aroundRTICSearch method of NavinfoTrafficRTICSearch.
[_rticSearch aroundRTICSearch:query];
7. Processing data in callbacks
Proxy method when the query is successful.
- (void)onTrafficRTICAroundSearch:(NavinfoTrafficRTICSearch * _Nonnull)rticSearch result:(NavinfoTrafficRTICResult * _Nullable)result error:(NSError * _Nullable)error;
where NavinfoTrafficRTICResult returns, NSError is nil, and the query result can be obtained at this time.
For the parameter information, please refer to [Road Traffic Voice Broadcast].
- (void)onTrafficRTICAroundSearch:(NavinfoTrafficRTICSearch *)rticSearch result:(NavinfoTrafficRTICResult *)result error:(NSError *)error { NSLog(@"----> onTrafficRTICAroundSearch: total=%ld, contents=%@",(long)result.totalCount, result.contents[0].rticInfo); }
8. Processing failed queries
When the retrieval fails, Error returns, and the reason for the failure is obtained by the callback function.
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 road traffic search query parameters
The request parameter class of the navigation line traffic search query is NavinfoTrafficNaviQuery, and the lonlats (latitude and longitude string) is a mandatory parameter.
Please refer to the API documentation for other non-essential parameters.
NavinfoTrafficNaviQuery *query = [NavinfoTrafficNaviQuery new]; NavinfoLonlat *lonlat1 = [[NavinfoLonlat alloc] initWith:(1162305) latitude:(4007837) gbType:NavinfoGbTypeG02]; NavinfoLonlat *lonlat2 = [[NavinfoLonlat alloc] initWith:(11623058) latitude:(4007822) gbType:NavinfoGbTypeG02]; NavinfoLonlat *lonlat3 = [[NavinfoLonlat alloc] initWith:11623069 latitude:4007801 gbType:NavinfoGbTypeG02]; NavinfoLonlat *lonlat4 = [[NavinfoLonlat alloc] initWith:11623114 latitude:4007706 gbType:NavinfoGbTypeG02]; NavinfoLonlat *lonlat5 = [[NavinfoLonlat alloc] initWith:11623138 latitude:4007622 gbType:NavinfoGbTypeG02]; query.lonlats = @[lonlat1,lonlat2,lonlat3,lonlat4,lonlat5];
6. Initiate search query parameters
Initiate a navigation line traffic search query by calling the naviRTICSearch method of NavinfoTrafficRTICSearch.
[_rticSearch naviRTICSearch:query];
7. Processing data in callbacks
Proxy method when the query is successful.
- (void)onTrafficRTICNaviSearch:(NavinfoTrafficRTICSearch * _Nonnull)rticSearch result:(NavinfoTrafficRTICResult * _Nullable)result error:(NSError * _Nullable)error;
where NavinfoTrafficRTICResult returns, NSError is nil, and the query result can be obtained at this time.
For the parameter information, please refer to [Road Traffic Voice Broadcast].
- (void)onTrafficRTICNaviSearch:(NavinfoTrafficRTICSearch *)rticSearch result:(NavinfoTrafficRTICResult *) result error:(NSError *)error { NSLog(@"----> onTrafficRTICNaviSearch: total=%ld, contents=%@",(long)result.totalCount, result.contents[0].rticInfo); }
8. Processing failed queries
When the retrieval fails, Error returns, and the reason for the failure is obtained by the callback function.