ProjectNameApp.Swift파일에서
import SwiftUI
import GoogleMobileAds
import AdSupport
import AppTrackingTransparency
@main
struct ProjectNameApp: App {
init() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { get IDFA
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { status in
switch status {
case .authorized:
print("IDFA = \(ASIdentifierManager.shared().advertisingIdentifier)")
default:
print("fail")
}
}
}
}
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
info.plist에 NSUserTrackingUsageDescription 추가