我正在研究在 iOS 14 上获取 IDFA。我使用的是 iPhone 8 Plus。
我已经添加了
<key>NSUserTrackingUsageDescription</key>
<string>App would like to access IDFA for tracking purpose</string>
Run Code Online (Sandbox Code Playgroud)
在.plist文件中。
然后添加
let type = ATTrackingManager.trackingAuthorizationStatus;
Run Code Online (Sandbox Code Playgroud)
返回.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 …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过命令行或任何其他方式添加 swift 包。不使用 xcode UI。
我需要这个,因为我们正在使用 Unity 并且想要从 cocoapods 迁移到 SPM。我们需要通过 CI 系统来完成此操作。我看到更改是在 xcode 项目文件结构本身 -> project.pbxproj 内完成的。但理解和维护似乎很痛苦。
有命令行工具吗?
谢谢