メインコンテンツまでスキップ

UID2 SDK for iOS Reference Guide

UID2 SDK for iOS は、以下の用途に使用できます:

  • UID2 を使用して iOS アプリでクライアント ID を生成または確立します。
  • ビッドストリーム様に Advertising Token を取得します。
  • UID2 Token の自動リフレッシュ。

以下のiOS関連プラグインと関連ドキュメントも利用できます:

PurposeProduct/Documentation
Google Mobile Ads (GMA) SDK を使用して iOS/tvOS アプリから広告リクエストで secure signals として UID2 Token を送信するUID2 GMA Plugin for iOS Integration Guide
Google Interactive Media Ads SDK for iOS を使用して iOS/tvOS アプリから広告リクエストで secure signals として UID2 Token を送信するUID2 IMA Plugin for iOS Integration Guide

tvOS Support

Although this page refers to UID2 SDK for iOS, this SDK also supports tvOS. For the required tvOS version, see Minimum Requirements.

Functionality

この SDK は、iOS デバイス上で動作するアプリで UID2 をサポートしたいパブリッシャー向けに、UID2 とのインテグレーションを簡素化します。次の表に、この SDK がサポートする機能を示します。

Encrypt Raw UID2 to UID2 TokenDecrypt UID2 TokenGenerate UID2 Token from DIIRefresh UID2 Token
Not supportedNot supportedSupportedSupported

UID2 SDK for iOS は、iOS アプリケーションに代わって UID2 ID を生成または管理するように設計されています。プラットフォームネイティブの暗号化ツールを使って ID をデバイスに安全に保存することで、UID2 ID をアプリのライフサイクル全体にわたって持続させることができます。

デフォルトでは、SDK は有効期限に基づいて UID2 ID を自動的にリフレッシュします。ただし、これを無効にして、アプリが UID2 IDのライフサイクルを手動で管理できるように実装することもできます。

API Permissions

この SDK を使用するには、Account Setup ページに記載されている手順に従って UID2 アカウントのセットアップを完了する必要があります。 SDKが提供する特定の機能を使用する許可が与えられ、そのアクセス用の認証情報が与えられます。

SDK Version

このドキュメントは、iOS 用 UID2 SDK のバージョン 1.2.0 以降に対応しています。

リリースノートの情報については、https://github.com/IABTechLab/uid2-ios-sdk/releases を参照してください。

GitHub Open-Source Repository

この SDK は以下のオープンソースの GitHub リポジトリにあります:

Minimum Requirements

この SDK の最小要件は以下の通りです:

  • Xcode version: 15.0+
  • iOS minimum target version: 13.0+
  • tvOS minimum target version: 13.0+
  • Swift version: 5.0+

Installation

Swift Package Manager (SPM) を使って iOS SDK をインストールします。2つのインストールオプションがあります:

Installing with Package.swift

Package.swift に次の依存関係を追加します:

dependencies: [
.package(url: "https://github.com/IABTechLab/uid2-ios-sdk.git", from: "1.2.0"),
]

Installing with Xcode

アプリの Package Dependencies に次のエントリを追加します:

NameLocationDependency Rule
uid2-ios-sdkgit@github.com:IABTechLab/uid2-ios-sdk.gitUp to next major version: 1.2.0 < 2.0.0

Installing with CocoaPods

Podfile に次のエントリを追加します:

pod 'UID2', '~> 1.2'

Usage Guidelines

UID2Manager シングルトンは、UID2 SDK for iOS の主要な開発者 API です。UID2 Token を含む UID2 Identity の保存、リフレッシュ、取得を行います。

iOS の場合、UID2Manager は初めてアクセスされたときに自動的に初期化されます。自動または手動のリフレッシュ機能をサポートするように設定できます。

UID2 Identity を確立する方法は2つあります:

  1. DII を使用して UID2 ID を生成します—メール (ハッシュ化または非ハッシュ化) または電話番号 (ハッシュ化または非ハッシュ化) を使用します。インテグレーション手順については、Client-Side Integration Guide for Mobile を参照してください。

  2. Server-Side で UID2 ID を生成し、それを UID2 SDK に渡します。インテグレーション手順については、Client-Server Integration Guide for Mobile を参照してください。

UID2 Mobile SDK は、UID2 identifier が確立された後に UID2 identities をリフレッシュできます。これは、リフレッシュ機能が UID2 Identity の一部である Refresh Token に依存しているためです。

Code Samples

The following code samples provide examples of performing specific activities relating to managing UID2 with the UID2 SDK for iOS.

Generate an initial UID2 Identity (for instructions, see Client-Side Integration Guide for Mobile):

UID2Manager.shared.generateIdentity(
_ identity: IdentityType,
subscriptionID: String,
serverPublicKey: String,
appName: String? = nil
)

初期 UID2 Identity を設定します (手順については、Client-Server Integration Guide for Mobile を参照してください):

UID2Manager.shared.setIdentity(_ identity: UID2Identity)

Advertising SDK (広告リクエストまたはビッドストリーム使用) に渡す UID2 Token (Advertising Token) を取得します:

UID2Manager.shared.getAdvertisingToken()

UID2Manager API

このセクションには、UID2Manager APIの一部である関数と変数が含まれています。

Functions

UID2Manager API の一部として利用可能な関数は次のとおりです:

generateIdentity()

Directly identifying information (DII) を使用して UID2 Identity を生成します。手順については、Client-Side Integration Guide for MobileClient-Side Integration Guide for Mobile を参照してください。

setIdentity()

SDK が管理する、Server-Side で作成された UID2 Identity を設定します。詳細については、Client-Server Integration Guide for MobileConfigure the UID2 Mobile SDK を参照してください。

resetIdentity()

SDK が管理している UID2 Identity をリセットまたは削除します。

refreshIdentity()

SDK が管理している UID2 Identity を手動でリフレッシュします。

getAdvertisingToken()

現在の UID2 Identity が有効である場合、この関数は UID2 Token (Advertising Token) を返します。

setAutomaticRefreshEnabled()

自動リフレッシュ機能の有効/無効を切り替えます。

Variables

UID2Manager APIでは、以下の変数を使用できます:

identity

Identity 変数は、SDK によって管理されている現在の UID2Identity データオブジェクトを格納し、返します。

identityStatus

identityStatus変数は、SDKが管理している現在のUID2 Identityのステータスを格納し、返します。