菜单

iOS ATT 请求追踪授权

此接口适用于用了归因服务的应用

SolarEngine SDK封装了系统的requestTrackingAuthorizationWithCompletionHandler,使用SDK封装的ATT授权接口SDK能第一时间知道用户的授权状态,能优先上报带有IDFA的Install事件,能优化归因效率。

Apple官方文档

 

调用ATT授权API需要在项目的Info.plist中添加 NSUserTrackingUsageDescription 字段,否则系统会强制闪退。

示例如下,描述请根据您的实际情况填写

NSUserTrackingUsageDescription
该权限仅用于标识设备、第三方广告、并保障服务安全与提示浏览体验。

 

completion回调值 status对应系统的ATTrackingManagerAuthorizationStatus

0: Not Determined;1: Restricted;2: Denied;3: Authorized ;999: system error

示例代码

 SolarEngineAPI::requestTrackingAuthorization([this](int status) {
       CCLOG("requestTrackingAuthorization callback : %d", status);
});

最近修改: 2025-09-23Powered by