Google Consent SDK:如何在UserDefaults中保存“状态”数组?

问题描述 投票:0回答:1

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

默认情况下,我必须存储“状态数组”。阵列中的当前状态可用后,将不会显示该同意表。如果没有,我们将显示表单并将该状态添加到默认状态数组中。

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

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

status error

 // 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个回答
0
投票

我对iOS知之甚少,但我想您只需要将作业写到一行即可:

PACConsentStatus status = PACConsentInformation.sharedInstance.consentStatus;
© www.soinside.com 2019 - 2024. All rights reserved.