我正在研究如何在 iOS 14 上获取 IDFA。我正在使用 iPhone 8 Plus。
我已经添加了
<key>NSUserTrackingUsageDescription</key>
<string>App would like to access IDFA for tracking purpose</string>
在.plist
文件中。
然后添加
let type = ATTrackingManager.trackingAuthorizationStatus;
返回.denied
,有
func requestPermission() {
ATTrackingManager.requestTrackingAuthorization { status in
switch status {
case .authorized:
// Tracking authorization dialog was shown
// and we are authorized
print("Authorized")
// Now that we are authorized we can get the IDFA
print(ASIdentifierManager.shared().advertisingIdentifier)
case .denied:
// Tracking authorization dialog was
// shown and permission is denied
print("Denied")
case .notDetermined:
// Tracking authorization dialog has not been shown
print("Not Determined")
case .restricted:
print("Restricted")
@unknown default:
print("Unknown")
}
}
}
但我.denied
没有任何弹出窗口。
你知道发生了什么吗?