KNSDK
INFO
This English reference is based on Directions SDK with UI 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 status of the SDK | 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
Notifies KNSDK when the application terminates. If route guidance is active, KNSDK saves its state and route.
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 | App key issued for using KNSDK |
aLangType | Language setting |
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 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 map type currently in use.
- (KNMapType) getMapTypesetMapType:complition
Selects the map type. Choose between a cloud-based map and a map downloaded locally.
- (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 | List of waypoints |
aCompletion | Block that delivers the route |
sharedGuidance
Gets KNGuidance. Only one KNGuidance instance exists.
- (KNGuidance *) sharedGuidancereqPoiText:page:completion
Searches for points of interest (POIs).
- (void) reqPoiText: (NSString *) aText
page: (int) aPage
completion: (void ( ^ ) ( KNError * NSDictionary *)) aCompletionParameters
| Name | Description |
|---|---|
aText | Name |
aPage | Search 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
Gets KNGPSManager. Only one KNGPSManager instance exists.
- (KNGPSManager *) sharedGpsManagerreverseGeocodeWithPos:completion
Returns the administrative district address for the KATEC coordinates. The callback returns the error code, administrative code, province name, city or county name, and neighborhood name in that order. Combine these values to form the address.
- (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 and returns them.
- (IntPoint) convertWGS84ToKATECWithLongitude: (double) aWgs84Lon
latitude: (double) aWgs84LatParameters
| Name | Description |
|---|---|
aWgs84Lon | Longitude of the WGS84 coordinates |
aWgs84Lat | Latitude of the 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 the KATEC coordinate system |
aKatecY | Y value in the KATEC coordinate system |
requestLocationUpdate
Registers a receiver with KNGPSManager to receive location information. When location information is received, it is delivered through the registered receiver.
- (void) requestLocationUpdate: (id <KNGPSReceiver>) aGPSReceiverParameters
| Name | Description |
|---|---|
aGPSReceiver | Receiver to register |
sharedConnection
Gets KNConnection. Only one KNConnection instance exists.
- (KNConnection *) sharedConnectionsetPOIRatio
Sets a scale to adjust the size of points of interest (POI). (min: 0.5, max: 2.0)
- (void) setPOIRatio: (float) aPOIRatiosetBuildingFlat
Sets whether to render buildings flat on the map. (default: NO)
- (void) setBuildingFlat: (bool) isBuildingFlatsetAppUserId
Sets the appUserId used to identify the user.
- (void) setAppUserId: (NSString *_Nullable) aAppUserIdParameters
| Name | Description |
|---|---|
aAppUserId | User identifier |