Migrating SDK from v1 to v2
Start the SDK
In version 1.x, the start
function is called with 3 parameters: AppId
, context
and enableDoctorCheck
(the later was added in 1.16.0).
In version 2.0, the start
function has additional parameter:
application
which replace thecontext
.delegate
(PerimeterXDelegate
) to handle the SDK's events.completion handler
to handle the result of the start process.
Notice that the new Interceptor will be enabled in 2.0. This has effect on the integration with the SDK, which i described in this document.
Set custom parameters
In version 1.x, the set custom parameters function is called with the dictionary parameter only.
In version 2.0, the setCustomParameters
function has another optional param: the AppID
. This is required only when using multiple AppIDs.
Get VID
In version 1.x, the get VID function is called without any parameters.
In version 2.0, the vid
function has another optional param: the AppID
. This is required only when using multiple AppIDs.
Get HTTP headers
In version 1.x, the get HTTP headers function is called without any parameters.
In version 2.0, the headersForURLRequest
function has another optional param: the AppID
. This is required only when using multiple AppIDs. Please note that now this function should NOT be used when the interceptor is enabled.
Check error and handle response
In version 1.x, a function is called to get the HUMAN's error response from the request's response which called another function to handle the HUMANÂ 's error response.
In version 2.0 the flow is as following:
- If the interceptor is enabled, simply check whether the request was blocked with the
isRequestBlockedError
function. - If the interceptor is disabled, use the HUMAN SDK to handle the response with the
handleResponse
function. If it was a blocked response, the SDK will handle it and the function will returntrue
.
Other functions
All other functions existing in version 1.x were removed from the SDK's API in version 2.0.
Updated 12 days ago