1

我已经在 Godot 游戏引擎中开发了我的游戏,现在我正在尝试将 googles gdpr 同意书实施到我的 Xcode 项目中。

我正在使用 Xcode 11.5

下面的代码是我当前的代码,它不会导致同意书弹出。这可能与我制作的课程有关,但我不确定它是如何工作的。

import UIKit
import PersonalizedAdConsent

class ViewController: UIViewController {

  override func viewDidLoad() {
    super.viewDidLoad()

    PACConsentInformation.sharedInstance.requestConsentInfoUpdate(
    forPublisherIdentifiers: ["I have the id just not posted here"])
    {(_ error: Error?) -> Void in
      if let error = error {
        // Consent info update failed.
      } else {
        // Consent info update succeeded. The shared PACConsentInformation
        // instance has been updated.
      }
    }

guard let privacyUrl = URL(string: "My_privacy_policy(not_actual)"),
  let form = PACConsentForm(applicationPrivacyPolicyURL: privacyUrl) else {
    print("incorrect privacy URL.")
    return
}
form.shouldOfferPersonalizedAds = true
form.shouldOfferNonPersonalizedAds = true
form.shouldOfferAdFree = false


form.load {(_ error: Error?) -> Void in
  print("Load complete.")
  if let error = error {
    // Handle error.
    print("Error loading form: \(error.localizedDescription)")
  } else {
    // Load successful.
  }
}

//Finally present the consent form
form.present(from: self) { (error, userPrefersAdFree) in
      if let error = error {
        // Handle error.
      } else if userPrefersAdFree {
        // User prefers to use a paid version of the app.
      } else {
        // Check the user's consent choice.
        let status =
             PACConsentInformation.sharedInstance.consentStatus
      }
    }

      }
}

任何帮助表示赞赏:)

4

0 回答 0