Connection
SDK Yandex ID for iOS can be installed:
- From the YandexLoginSDK CocoaPods repository.
- Through GitHub using Swift Package Manager.
Step 1. Configure a Podfile
If you use Swift Package Manager for SDK Yandex ID installation, skip this step and proceed to Step 2.
To import SDK Yandex ID from CocoaPods, you need to configure a Podfile following these instructions:
-
Go to the directory with your Xcode project and create a text
Podfilein one of the following ways:-
Like you normally would.
-
Using this command:
pod init
-
-
Open Podfile and add the following dependency:
pod 'YandexLoginSDK' -
Apply changes by runnning the following command:
$ pod install
Step 2. Configure Info.plist
Add the following strings to the Info.plist file:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>primaryyandexloginsdk</string>
<string>secondaryyandexloginsdk</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>YandexLoginSDK</string>
<key>CFBundleURLSchemes</key>
<array>
<string>yx{Client ID}</string>
</array>
</dict>
</array>
Add the following values to the Info.plist file:
-
The Information Property List dictionary:
-
The Queried URL Schemes key → a string array:
-
First array element → a "primaryyandexloginsdk" string.
-
Second array element → a "secondaryyandexloginsdk" string.
-
And so on.
-
-
The URL types key → an array of dictionaries:
-
One of the array elements:
-
URL identifier key → a "YandexLoginSDK" string.
-
URL Schemes key → a string array:
- One of the array elements → a "yx{Client ID}" string.
-
-
-
- You can find the app's Client ID in its properties.
Step 3. Configure Entitlements
SDK Yandex ID communicates with Yandex apps via Universal Links. For them to work, add the following string to Capability: Associated Domains:
applinks:yx{Client ID}.oauth.yandex.com
For example, if the app ID Client ID is ABCD2e, the string to be added looks like this:
applinks:yxABCD2e.oauth.yandex.com
Step 4. Import header files
Add this header to the project files where SDK Yandex ID is used:
import YandexLoginSDK