【问题标题】:Google Consent SDK: How to Save 'Status' Array in UserDefaults?Google Consent SDK:如何在 UserDefaults 中保存“状态”数组?
【发布时间】:2019-05-09 13:04:33
【问题描述】:

此代码中未使用变量“状态”。因此我无法检查用户的同意选择。

我必须在默认值中存储“状态数组”。一旦当前状态在数组中可用,它将不会显示该同意书。如果没有,那么我们将显示表单并将该状态添加到默认状态数组中。

现在我无法检查用户的同意选择,并且每次加载应用时都会加载表单。

这可能会解决问题,但我不知道如何在代码中做到这一点。有什么建议?

 // Load Form
[form loadWithCompletionHandler:^(NSError *_Nullable error) {
    NSLog(@"Load complete. Error: %@", error);
    if (error) {
        // Handle error.
    } else {
        // Load successful.


        [form presentFromViewController:self
                      dismissCompletion:^(NSError *_Nullable error, BOOL userPrefersAdFree) {
                          if (error) {
                              // Handle error.
                          } else if (userPrefersAdFree) {
                              // The user prefers to use a paid version of the app.



                          } else {

                              // Check the user's consent choice.
                              PACConsentStatus status =
                              PACConsentInformation.sharedInstance.consentStatus;


                              // store status array in defaults
                              // once current status is available in array we will not show that form
                             // if not then we will show form and add that status in defaults status array





                              //Storing publisher managed consent
                              PACConsentInformation.sharedInstance.consentStatus = PACConsentStatusPersonalized;



                          }
                      }];

【问题讨论】:

    标签: ios nsuserdefaults userdefaults cookieconsent admob-cookieconsent


    【解决方案1】:

    我对 iOS 知之甚少,但我猜你只需要将作业写成一行:

    PACConsentStatus status = PACConsentInformation.sharedInstance.consentStatus;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-25
      • 2018-07-18
      • 2017-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-14
      • 1970-01-01
      相关资源
      最近更新 更多