> This page is for Applications Protection.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.humansecurity.com/llms.txt.

# Migrating SDK from v2 to v3

## Start the SDK

In version 2.x, the `start` function is called with four parameters: `appId`, `delegate`, `enableDoctorCheck` and `completion`.

In version 3.0, there are two `start` functions, both of them has only three parameters: `appId` (or `appIds`), `delegate` and `policy`. Those functions throw an error on failure. Also, this function should be called only once.

In version 3.0, the `setPolicy` function was removed. The policy can be set via the `PerimeterX/start(appId:delegate:policy:)` function.

In version 3.0, the `hybrid app support` is disabled by default (it was enabled in 2.x). To enable it, the `PXPolicy/hybridAppSupportEnabled` property need to be set to `true`. the function `turnOffHybridAppSupport` was removed.

In version 3.0, the `PXPolicy`'s properties were changed. In order to configure automatic interception you should use the new `PXPolicyUrlRequestInterceptionType` enum and the new `PXPolicy/urlRequestInterceptionType` property.

## Set custom parameters

In version 2.x, the `setCustomParameters` function had a completion handler. It was removed in 3.0.

## Other functions

In version 3.0, the signature of `canHandleResponse` function was changed. However, the function receive the same parameters.

In version 3.0, the signature of `handleResponse` function was changed. However, the function receive the same parameters.

In version 3.0, the signature of `setUserId` function was changed. However, the function receive the same parameters.

In version 3.0, the signature of `registerOutgoingUrlRequest` function was changed. However, the function receive the same parameters.

In version 3.0, the function `addInitializationFinishedCallback` was removed.

In version 3.0, `registerCallbackForRequestBlockedEvent`, `registerCallbackForChallengeSolvedEvent`, `registerCallbackForChallengeCancelledEvent` functions were removed.

### Error codes

In version 3.0, the `PerimeterXErrorCode` enum was change: `initializationFailed` and `initializationAlreadyRunning` were removed. New cases were added.