iOS SDK
This page explains how to use App2App iOS SDK to use Klip on your BApp.
Last updated
Was this helpful?
This page explains how to use App2App iOS SDK to use Klip on your BApp.
Last updated
Was this helpful?
iOS 12.0 or higher
Swift 5.0 or higher
Xcode 13.4 or higher
Klip iOS SDK doesn't require a separate registration process. It works in any environment where HTTP communication is available. Still, users must have KakaoTalk installed to make the requests because the user's consent is received using the Klip application or Klip located in the More[…] tab in the mobile app KakaoTalk.
Download Klip iOS SDK in
Execute your project with Xcode
Go to Xcode > Project's TARGETS > General Tab > Frameworks, Libraries, and Embedded Content Tab and click on the + button
Select the sdk directory of Klip SDK project downloaded in Source Directory and click Next
Check if the SDK is imported to Frameworks in the Project Navigator and build.
Once the Klip SDK source is copied to your project, you can modify the library code yourself.
To execute applications like KakaoTalk using iOS SDK with iOS 9.0 or higher, you have to register a custom scheme in the Info.plist file.
Add an array type key LSApplicationQueriesSchemes in [Info] > [Custom iOS Target Properties], and add 'klip' and 'itms-apps' as 'Item' of that key.
App2App API requests are made in the order: prepare
, request
, and getResult
.
prepare
is the step in which requests (from of a total of five) are defined
request
is the step in which the function is called and the signing takes place on Klip
getResult
is the step in which the result is returned from the function call
Creates an instance to use Klip SDK.
Return Value
Klip
Klip instance
Example
KlipSDK.shared.prepare(request: KlipRequest, bappInfo: BAppInfo, completion: @escaping(KlipCallback<KlipTxResponse>) -> Void)
Prepares to process an App2App API request and issues a request key.
Request Objects
Connecting Klip(=authentication) AuthRequest
Sending KLAY KlayTxRequest
Sending Token TokenTxRequest
Sending Card CardTxRequest
Executing Contract ContractTxRequest
Parameters
request
KlipRequest
Requested information depending on request type
bappInfo
BAppInfo
Information of the requested BApp
callback
KlipCallback<KlipTxResponse>
The callback function to obtain the response. If it's successful, it returns KlipTxResponse
, and if not it returns KlipErrorResponse
.
Requesting consent to Klip users will return the data entered in request
and bappInfo
. The request key returned in the response serves as a key when requesting transactions to users, and is used with KlipSDK.shared.getResult and KlipSDK.shared.request.
Example 1. Obtaining User Information
Example 2. Sending KLAY
Example 3. Sending Token
Example 4. Sending Card
Example 5. Execute Contract
KlipSDK.shared.request(requestKey: String), isKlipAppCall: Bool = false) -> Void
Requests authentification or signature using deep link. Under the below circumstances, it would redirect automatically to the download page of Klip or KakaoTalk on the Apple AppStore.
If the device doesn't have Klip or KakaoTalk installed
The version of the installed KakaoTalk doesn't support Klip
Parameters
requestKey
String
Request Number (Obtained from Klip Server)
isKlipAppCall
Bool
If the Klip app was called first, then it should true
Example
KlipSDK.shared.getResult(requestKey: String, completion: @escaping(KlipCallback<KlipTxResponse>) -> Void)
Checks the result of an App2App API request
Parameters
requestKey
String
Request Number (Obtained from Klip Server)
callback
KlipCallback<KlipTxResponse>
The callback function to obtain the response. If it's successful, it returns KlipTxResponse
, and if not it returns KlipErrorResponse
.
Example
KlipSDK.shared.getCardList(cardAddress: String, userAddress: String, cursor: String?, completion: @escaping(KlipCallback<CardListResponse>) -> Void)
Returns a list of certain Cards of a user
Parameters
cardAddress
String
The address of the Card to return
userAddress
String
The address of the user to return
cursor
String
(optional) The pointer after which the next request will retrieve the next 100 items if the number of Cards exceeds 100.
callback
KlipCallback<CardListResponse>
The callback function to obtain the response. If it's successful, it returns CardListResponse
, and if not it returns KlipErrorResponse
.
Example
-
-
500
10
Error in Klip SDK (ex. HTTP c connection failure)
500
21
Error in Klip SDK (Klip REST API unsupported error code)
500
22
Error in Klip SDK (Klip protocol error)
In addition, getCardList
is a function provided for the convenience of BApp developers that returns a list of NFTs of a Klip user.
If you need help with this document or Klip in general, please visit our .
To implement the request step using QR code, please refer to .
Same as