IOS 14.5が最近リリースされ、少し前にAppleは、このバージョンのOS以降、IDFAにアクセスできるAppTrackingTransparencyフレームワークをサポートする必要があることを開発者に警告しました。
IDFA (The Device Identifier For Advertisers) — , . . .
, , :
Zeroed out IDFA: 00000000-0000-0000-0000-000000000000
Apple AppTrackingTransparency, 26 , . , .
?
AppsFlyer, 40 % IDFA. , , , .
Facebook Instagram , , , .
, . , , ; Win-win, . , IDFA.
, , . . , .
AppTrackingTransparency . info.plist :
<key>NSUserTrackingUsageDescription</key>
<string> ? , .</string>
, !
. iOS 14.5, , .
private func requestTrackingAuthorization() {
guard #available(iOS 14, *) else { return }
ATTrackingManager.requestTrackingAuthorization { _ in
DispatchQueue.main.async { [weak self] in
// self?.router.close() or nothing to do
}
}
}
didFinishLaunchingWithOptions.
import AppTrackingTransparency
. .
, , . AuthorizationStatus, requestTrackingAuthorization.
private func requestTrackingAuthorization() {
guard #available(iOS 14, *) else { return }
ATTrackingManager.requestTrackingAuthorization { status in
DispatchQueue.main.async {
switch status {
case .authorized:
let idfa = ASIdentifierManager.shared().advertisingIdentifier
print(" . IDFA: ", idfa)
case .denied, .restricted:
print(" .")
case .notDetermined:
print(" .")
@unknown default:
break
}
}
}
}
requestTrackingAuthorization(completionHandler:) .notDetermined. .
, . , UI.
, , .denied .restricted. , , IDFA, , . , :
func goToAppSettings() {
guard let url = URL(string: UIApplication.openSettingsURLString),
UIApplication.shared.canOpenURL(url)
else {
return
}
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
. ATT? !