美文网首页
AppStore_审核 App Tracking Transpa

AppStore_审核 App Tracking Transpa

作者: Eyes_cc | 来源:发表于2021-04-30 10:26 被阅读0次
    【简介】

    https://developer.apple.com/documentation/apptrackingtransparency/


    【步骤】

    1、

    import AppTrackingTransparency
    import AdSupport
    
    /// adid
    public var cn_Adid: String {
        if #available(iOS 14.0, *) {
            var str = ""
            ATTrackingManager.requestTrackingAuthorization { (status) in
                if status == .authorized {
                    str = ASIdentifierManager.shared().advertisingIdentifier.uuidString
                }
                if status == .denied {
                    str = "用户不允许获取adid"
                }
            }
            return str
        } else {
            return ASIdentifierManager.shared().advertisingIdentifier.uuidString
        }
    }
    

    2 、


    3、

    // 通用参数
    public var basePara: [String: String] {
        var token = ""
            
        token = UserDefaultsManager.queryDataForString(UserDefaultsName.User_token)
        let localVersion: String = (Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String) // 版本号
        let localBuildVersion: String = (Bundle.main.infoDictionary!["CFBundleVersion"] as! String)     // 构建号
            
        let device_id = requestAdPermission()
    
        return ["term": "ios", "token": token, "device_model": UIDevice.current.modelName, "device_system": UIDevice.current.systemVersion, "version": localVersion, "buildVersion": localBuildVersion, "versionCode": localVersion, "device_id": device_id]
    }
    

    相关文章

      网友评论

          本文标题:AppStore_审核 App Tracking Transpa

          本文链接:https://www.haomeiwen.com/subject/dehnrltx.html