Мы постоянно публикуем обновления документации, которые могут быть недоступны на вашем языке. Наиболее актуальные сведения содержатся в версии на английском языке.

Get started with the iOS SDK

The Adjust iOS SDK enables you to track attribution, events, and much more in your iOS app. Follow the steps in this guide to set up your app to work with the Adjust SDK. You can also check out our example apps on GitHub.

Step one: set up your environment

To start using the Adjust SDK, you will first need to add it to your project as a dependency.

Важно:
The Adjust SDK supports iOS 9 or later.

Cocoapods

Carthage

Swift package manager

Add as framework

Step two: integrate the SDK

Cocoapods

Carthage and framework import

Step three: add iOS frameworks

The Adjust SDK is able to get extra information when you include certain iOS frameworks in your app. Adding frameworks and marking them as optional enables additional features in the Adjust SDK.

FrameworkDescriptionNotes
AdSupport.frameworkThis framework is needed so that the SDK can access the IDFA value and – prior to iOS 14 – LAT information.If your app is targeting the "Kids" category, you should not implement this framework.
AdServices.frameworkThis framework is needed to handle Apple Search Ads attribution.
StoreKit.frameworkThis framework is needed to access the SKAdNetwork framework and for the Adjust SDK to handle communication with it automatically in iOS 14 or later.
AppTrackingTransparency.frameworkThis framework is needed in iOS 14 and later for the SDK to be able to wrap the user tracking consent dialog and access the user’s consent response.If your app is targeting the "Kids" category, you should not implement this framework.
WebKit.frameworkThis framework allows you to make use of web views in your application.This is only needed if your app makes use of web views.

Step four: initialize the SDK

Once you've added all necessary frameworks, you can initialize the Adjust SDK within your application. To do this, initialize your ADJConfig object with your app token and the environment you want to run your application in.

Важно:
When running tests you should ensure that your environment is set to ADJEnvironmentSandbox. Change this to ADJEnvironmentProduction before you submit your application to the App Store.

Standard setup

iMessage setup

Web bridge setup

Step five: set up logging

Примечание:
If you want to disable all logging, set allowSuppressLogLevel to true in your ADJConfig instance and call the setLogLevel method with the value ADJLogLevelSuppress.

To set the verbosity of logging, use the logLevel property in your ADJConfig instance. You need to do this before calling appDidLaunch for it to take effect.

Objective-C
Swift
Javascript
[adjustConfig setLogLevel:ADJLogLevelVerbose];

Step six: build your app

Well done! You should now be able to build and run your app. Enable logging to check for any issues. You are ready to start attributing your users with the Adjust SDK.