KNSDK
INFO
This English reference is based on Directions SDK 1.12.12. For the latest version, see the Korean reference.
- Inherits from: NSObject
- Declared in: KNSDK.h
KNSDK provides three main features for using Kakao Navi: map, route, and guidance. These three features are separated into individual modules so that you can select and use only the features your service needs. For example, you can use the route module to check the estimated time of arrival (ETA), integrate the map module to display a route on the map, and integrate the guidance module to implement navigation.
Properties
| Name | Description | Type |
|---|---|---|
initSt | Authentication and initialization state | var initSt: KNSDKInitState |
delegate | Delegate that reports the SDK status | var delegate: KNSDKDelegate? |
Constructor
+ sdkVersion
Returns the version of the KNSDK in use.
+ (NSString *) sdkVersion+ sharedInstance
Returns the singleton KNSDK instance.
+ (nullable KNSDK *) sharedInstance+ releaseInstance
Releases the singleton KNSDK instance.
+ (void) releaseInstance+ handleWillResignActive
Notifies KNSDK when the application enters the paused state.
Example code — + handleWillResignActive
- (void)applicationWillResignActive:(UIApplication *)application {
[KNSDK handleWillResignActive];
}+ (void) handleWillResignActive+ handleDidEnterBackground
Notifies KNSDK when the application enters the background state.
Example code — + handleDidEnterBackground
- (void)applicationDidEnterBackground:(UIApplication *)application {
[KNSDK handleDidEnterBackground];
}+ (void) handleDidEnterBackground+ handleWillEnterForeground
Notifies KNSDK when the application enters the foreground state.
Example code — + handleWillEnterForeground
- (void)applicationWillEnterForeground:(UIApplication *)application {
[KNSDK handleWillEnterForeground];
}+ (void) handleWillEnterForeground+ handleDidBecomeActive
Notifies KNSDK when the application enters the resumed state. When the state is resumed, the paused state of voice guidance is released.
Example code — + handleDidBecomeActive
- (void)applicationDidBecomeActive:(UIApplication *)application {
[KNSDK handleDidBecomeActive];
}+ (void) handleDidBecomeActive+ handleWillTerminate
When the app terminates, saves the current guidance state and route in KNSDK if guidance is active.
Example code — + handleWillTerminate
- (void)applicationWillTerminate:(UIApplication *)application {
[KNSDK handleWillTerminate];
}+ (void) handleWillTerminate+ handleCarInterfaceConnected
Notifies KNSDK that the application has connected to an in-vehicle infotainment system.
+ (void) handleCarInterfaceConnected+ handleCarInterfaceDisconnected
Notifies KNSDK that the application has disconnected from the in-vehicle infotainment system.
+ (void) handleCarInterfaceDisconnectedMethods
initializeWithAppKey:clientVersion:userKey:langType:mapType:completion
Initializes KNSDK.
TIP
You must initialize KNSDK before using it.
Example code — KNSDK
[[KNSDK sharedInstance] initializeWithApiKey:@"API Key" userKey:@"User Key" langType:KNLanguageType_KOREAN completion:^(KNError *error) {
if (error)
{
// SDK initialization failed
}
else
{
// SDK initialization succeeded
}
}];- (void) initializeWithAppKey: (NSString *) aAppKey
clientVersion: (NSString *) aClientVersion
userKey: (NSString *_Nullable) aUserKey
langType: (KNLanguageType) aLangType
mapType: (KNMapType) aMapType
completion: (void ( ^ ) ( KNError *aError )) aCompletionParameters
| Name | Description |
|---|---|
aAppKey | AppKey issued for using KNSDK |
aLangType | Language settings |
aUserKey | The UserKey used to identify a user. The key value is issued by the service, and KNSDK uses it to identify individual users and provide personalized services. |
aMapType | Map type (MapType) setting |
aCompletion | Delivers the result state after initialization completes |
mapVersion
Returns the current map version.
- (SInt32) mapVersionmakeMapViewWithFrame
Requests a map view object. Internally binds and initializes the loader, styler, and renderer, then returns it.
TIP
The map view object must be created through KNSDK.
- (KNMapView *_Nullable) makeMapViewWithFrame: (CGRect) aFramesharedMapDownLoader
Returns the map downloader used to download the full map.
- (KNMapDownLoader *) sharedMapDownLoadergetMapType
Returns the current map type.
- (KNMapType) getMapTypesetMapType:complition
Selects either the cloud-based map or the locally downloaded full-map type.
- (void) setMapType: (KNMapType) aMapType
complition: (void ( ^ ) ( KNError *)) aCompletionmapCacheDeleteCompletion
Deletes cached map data.
- (void) mapCacheDeleteCompletion: (void ( ^ ) ( KNError *aError )) aCompletionmakeTripWithStart:goal:vias:completion
Creates a KNTrip.
- (void) makeTripWithStart: (KNPOI *) aStart
goal: (KNPOI *) aGoal
vias: (NSArray<KNPOI*> *_Nullable) aVias
completion: (void ( ^ ) ( KNError *aError KNTrip *aTrip )) aCompletionParameters
| Name | Description |
|---|---|
aStart | Origin |
aGoal | Destination |
aVias | Waypoint list |
aCompletion | Route completion block |
sharedGuidance
Gets KNGuidance. Only one KNGuidance instance exists.
- (KNGuidance *) sharedGuidancereqPoiText:page:completion
Searches for a Point of Interest (POI).
- (void) reqPoiText: (NSString *) aText
page: (int) aPage
completion: (void ( ^ ) ( KNError * NSDictionary *)) aCompletionParameters
| Name | Description |
|---|---|
aText | Name |
aPage | Search result page |
setUserKey
Passes the key used to identify a user (UserKey) to KNSDK.
- (void) setUserKey: (NSString *_Nullable) aUserKeyParameters
| Name | Description |
|---|---|
aUserKey | The UserKey used to identify a user. The key value is issued by the service, and KNSDK uses it to identify individual users and provide personalized services. |
sharedGpsManager
Returns the singleton KNGPSManager instance.
- (KNGPSManager *) sharedGpsManagerreverseGeocodeWithPos:completion
Returns the administrative-district Address for the specified KATEC coordinates. The values are returned in this order: error code, administrative code, province, city/county/district, and neighborhood.
- (void) reverseGeocodeWithPos: (IntPoint) aKatecPos
completion: (void ( ^ ) ( KNError *_Nullable aError NSString *_Nullable aAddrCode NSString *_Nullable aDoName NSString *_Nullable aSiGunGuName NSString *_Nullable aDongName )) aCompletionParameters
| Name | Description |
|---|---|
aKatecPos | KATEC coordinates to convert to an Address |
aCompletion | Administrative-district Address for the KATEC coordinates |
convertWGS84ToKATEC
Converts WGS84 coordinates to KATEC coordinates.
- (IntPoint) convertWGS84ToKATECWithLongitude: (double) aWgs84Lon
latitude: (double) aWgs84LatParameters
| Name | Description |
|---|---|
aWgs84Lon | Longitude in WGS84 coordinates |
aWgs84Lat | Latitude in WGS84 coordinates |
convertKATECToWGS84WithX:y
Converts KATEC coordinates to WGS84 coordinates and returns them.
- (DoublePoint) convertKATECToWGS84WithX: (SInt32) aKatecX
y: (SInt32) aKatecYParameters
| Name | Description |
|---|---|
aKatecX | X value in KATEC coordinates |
aKatecY | Y value in KATEC coordinates |
requestLocationUpdate
Registers a receiver for location updates from KNGPSManager. The registered receiver receives each location update.
- (void) requestLocationUpdate: (id <KNGPSReceiver>) aGPSReceiverParameters
| Name | Description |
|---|---|
aGPSReceiver | Receiver to register |
sharedConnection
Returns the singleton KNConnection instance.
- (KNConnection *) sharedConnectionsharedParkingLotManager
Returns KNParkingLotManager, which requests and receives parking-lot information. Only one instance exists.
- (KNParkingLotManager *) sharedParkingLotManager;setPOIRatio
Sets a scale to adjust the size of points of interest (POI). (min: 0.5, max: 2.0)
- (void) setPOIRatio: (float) aPOIRatiosetBuildingFlat
Sets whether buildings appear flat on the map. (default: NO)
- (void) setBuildingFlat: (bool) isBuildingFlatsetAppUserId
Sets appUserId to identify the user.
- (void) setAppUserId: (NSString *_Nullable) aAppUserIdParameters
| Name | Description |
|---|---|
aAppUserId | User identifier |