AppLovin / AppLovin-MAX-SDK-iOS

84 stars 69 forks source link

Initialization completion callback may not be called in SDK v12.4.1 #319

Open takazawa-gg opened 3 weeks ago

takazawa-gg commented 3 weeks ago

MAX SDK Version

12.4.1

Device/Platform Info

iOS 17.3.1 / iPhone 14 Pro

Current Behavior

In our app, there is a chance that the initialization completion callback will not be called about 1 in 20 times when Max is initialized.

This issue is resolved by simply restarting the app. It occurs randomly with the same app, same build, same device, and same communication status.

I submitted my app to the AppStore this time, but unfortunately this problem seemed to occur during review, and it was rejected because the reward ad could not be played (unable to load).

We are attempting to reproduce the symptoms and collect logs by building with verbose logging enabled, but are unable to reproduce the issue at this time.

I just thought I'd report this issue anyway.

This is the only log we can provide at this time. The ad is loaded in the initialization completion callback.

Log when an abnormality occurs

デフォルト   20:37:39.561291+0900    psycho2 [AppLovinSdk] DEBUG [ALSdkInitializationConfiguration] Initializing with key: *****
デフォルト   20:37:39.561333+0900    psycho2 [AppLovinSdk] DEBUG [ALConsentFlowSettings] Setting privacy policy: https://*****
デフォルト   20:37:39.561376+0900    psycho2 [AppLovinSdk] DEBUG [ALConsentFlowSettings] Setting terms of service:
デフォルト   20:37:39.561403+0900    psycho2 [AppLovinSdk] DEBUG [ALSdkInitializationConfiguration] -[ALSdkInitializationConfiguration setMediationProvider: max]
デフォルト   20:37:39.579216+0900    psycho2 [AppLovinSdk] DEBUG [ALSdk] Setting plugin version: (null)
デフォルト   20:37:39.900464+0900    psycho2 [AppLovinSdk] DEBUG [AppLovinSdk] 
========================================
=====AppLovin SDK=====
===SDK Versions===
Version: 12.4.1
Plugin Version: 
Ad Review Version: 7.1.4
OM SDK Version: 1.4.12-Applovin
===Device Info===
OS: iOS 17.3.1
IDFA: <Enable verbose logging to see the IDFA to use for test devices - https://monetization-support.applovin.com/hc/en-us/articles/236114328-How-can-I-expose-verbose-logging-for-the-SDK>
IDFV: <Enable verbose logging to see the IDFV to use for test devices - https://monetization-support.applovin.com/hc/en-us/articles/236114328-How-can-I-expose-verbose-logging-for-the-SDK>
Model: iPhone15,2
Locale: ja_JP
Simulator: 0
Tablet: 0
===App Info===
Bundle ID: *****
Has AppLovinSDKResources: true
NSAdvertisingAttributionReportEndpoint: https://*****
===SDK Settings===
SDK Key: *****
Mediation Provider: max
TG: 92
AEI: 46
MEI: 6
MD: FR4p/BAVABUAFQAAFQAVABUCABUAFQA<…>
デフォルト   20:38:39.731722+0900    psycho2 [AppLovinSdk] DEBUG [ALErrorReporter] integration_error reported with code 200 and extra parameters {
    source = "no_ads_loaded";
}

Log when no problem occurs

デフォルト   20:40:18.722069+0900    psycho2 [AppLovinSdk] DEBUG [ALSdkInitializationConfiguration] Initializing with key: *****
デフォルト   20:40:18.722162+0900    psycho2 [AppLovinSdk] DEBUG [ALConsentFlowSettings] Setting privacy policy: https://*****
デフォルト   20:40:18.722218+0900    psycho2 [AppLovinSdk] DEBUG [ALConsentFlowSettings] Setting terms of service:
デフォルト   20:40:18.722289+0900    psycho2 [AppLovinSdk] DEBUG [ALSdkInitializationConfiguration] -[ALSdkInitializationConfiguration setMediationProvider: max]
デフォルト   20:40:18.749265+0900    psycho2 [AppLovinSdk] DEBUG [ALSdk] Setting plugin version: (null)
デフォルト   20:40:18.988770+0900    psycho2 [AppLovinSdk] DEBUG [AppLovinSdk] 
========================================
=====AppLovin SDK=====
===SDK Versions===
Version: 12.4.1
Plugin Version: 
Ad Review Version: 7.1.4
OM SDK Version: 1.4.12-Applovin
===Device Info===
OS: iOS 17.3.1
IDFA: <Enable verbose logging to see the IDFA to use for test devices - https://monetization-support.applovin.com/hc/en-us/articles/236114328-How-can-I-expose-verbose-logging-for-the-SDK>
IDFV: <Enable verbose logging to see the IDFV to use for test devices - https://monetization-support.applovin.com/hc/en-us/articles/236114328-How-can-I-expose-verbose-logging-for-the-SDK>
Model: iPhone15,2
Locale: ja_JP
Simulator: 0
Tablet: 0
===App Info===
Bundle ID: *****
Has AppLovinSDKResources: true
NSAdvertisingAttributionReportEndpoint: https://*****
===SDK Settings===
SDK Key: *****
Mediation Provider: max
TG: 92
AEI: 46
MEI: 6
MD: FR4p/BAVABUAFQAAFQAVABUCABUAFQA<…>
デフォルト   20:40:19.000565+0900    psycho2 [AppLovinSdk] DEBUG [MAInterstitialAd] Created new MAInterstitialAd (<MAFullscreenAdController: 0x2833d3740>)
デフォルト   20:40:19.000611+0900    psycho2 [AppLovinSdk] DEBUG [MARewardedAd] Created new MARewardedAd (<MAFullscreenAdController: 0x2833d3c20>)

Expected Behavior

No response

How to Reproduce

Occurs randomly during initialization.

Additional Info

No response

thomasmso commented 3 weeks ago

Hi @takazawa-gg, thank you for reporting this. Would you be able to enable our SDK's verbose logs and send them over when you are able to reproduce the issue?

takazawa-gg commented 3 weeks ago

I tried collecting verbose logs. (Sorry, I don't know why, but the logs are recorded double or triple and it's hard to see.)

20240423_NG.txt 20240423_OK.txt

Please check the log excerpt below for the timing of SDK initialization.

When there are no problems, the log "[ALSdk] Marking SDK initialized: 1" is recorded, but it seems that the log is not recorded when the initialization completion callback is not called.

Log when an abnormality occurs (20240423_NG.txt)

デフォルト   14:49:47.698534+0900    *****   [AppLovinSdk] DEBUG [ALSdkInitializationConfiguration] Initializing with key: ucib6meZCRF8F-PTOM4mO3Pu5R2GRkCxL1zJGwX2aT0Th1L-pqKLFhF_v_6qM0VrP1TT10UTyTWLCfhTirsFcs
デフォルト   14:49:47.698647+0900    *****   [AppLovinSdk] DEBUG [ALSdkSettings] -[ALSdkSettings setVerboseLoggingEnabled: 1]
デフォルト   14:49:47.699147+0900    *****   [AppLovinSdk] DEBUG [ALSdkInitializationConfiguration] -[ALSdkInitializationConfiguration setMediationProvider: max]
デフォルト   14:49:48.206698+0900    *****   [AppLovinSdk] DEBUG [ALSdk] Unified flow completed with status: [ALConsentFlowCompletionStatus: isCMPPromptShown=0, isATTPromptShown=0, error=[ALConsentFlowError code=-100, message=Failed to start consent flow. Please make sure that the consent flow is enabled.]]
デフォルト   14:49:48.207140+0900    *****   [AppLovinSdk] DEBUG [ALSdk] Initializing SDK in MAX environment...
デフォルト   14:49:48.207417+0900    *****   [AppLovinSdk] DEBUG [ALTaskInitializeSdk] Initializing AppLovin SDK v12.4.1...

Log when no problem occurs (20240423_OK.txt)

デフォルト   14:50:05.061424+0900    *****   [AppLovinSdk] DEBUG [ALSdkSettings] -[ALSdkSettings setVerboseLoggingEnabled: 1]
デフォルト   14:50:05.061712+0900    *****   [AppLovinSdk] DEBUG [ALSdkInitializationConfiguration] -[ALSdkInitializationConfiguration setMediationProvider: max]
デフォルト   14:50:05.061388+0900    *****   [AppLovinSdk] DEBUG [ALSdkInitializationConfiguration] Initializing with key: ucib6meZCRF8F-PTOM4mO3Pu5R2GRkCxL1zJGwX2aT0Th1L-pqKLFhF_v_6qM0VrP1TT10UTyTWLCfhTirsFcs
デフォルト   14:50:05.130935+0900    *****   [AppLovinSdk] DEBUG [ALSdk] Initializing SDK for non-maiden launch
デフォルト   14:50:05.131541+0900    *****   [AppLovinSdk] DEBUG [ALSdk] Setting plugin version: (null)
デフォルト   14:50:05.399741+0900    *****   [AppLovinSdk] DEBUG [ALSdk] Unified flow completed with status: [ALConsentFlowCompletionStatus: isCMPPromptShown=0, isATTPromptShown=0, error=[ALConsentFlowError code=-100, message=Failed to start consent flow. Please make sure that the consent flow is enabled.]]
デフォルト   14:50:05.399777+0900    *****   [AppLovinSdk] DEBUG [ALSdk] Initializing SDK in MAX environment...
デフォルト   14:50:05.399843+0900    *****   [AppLovinSdk] DEBUG [ALTaskInitializeSdk] Initializing AppLovin SDK v12.4.1...
デフォルト   14:50:05.406399+0900    *****   [AppLovinSdk] DEBUG [ALSdk] Marking SDK initialized: 1
デフォルト   14:50:05.407524+0900    *****   [AppLovinSdk] DEBUG [ALSdk] Calling back publisher's initialization completion handler...
デフォルト   14:50:05.409209+0900    *****   [AppLovinSdk] DEBUG [MAInterstitialAd] -[MAInterstitialAd initWithAdUnitIdentifier: 1ae4ddf9dfa5ff86 sdk: [ALSdk: key=ucib6meZCRF8F-PTOM4mO3Pu5R2GRkCxL1zJGwX2aT0Th1L-pqKLFhF_v_6qM0VrP1TT10UTyTWLCfhTirsFcs, enabled=1, isFirstSession=0]]
デフォルト   14:50:05.413080+0900    *****   [AppLovinSdk] DEBUG [ALSdk] Detected mediation provider: MAX
デフォルト   14:50:05.413414+0900    *****   [AppLovinSdk] DEBUG [MARewardedAd] +[MARewardedAd sharedWithAdUnitIdentifier: de2d7dfb3fb1b31b, sdk: [ALSdk: key=ucib6meZCRF8F-PTOM4mO3Pu5R2GRkCxL1zJGwX2aT0Th1L-pqKLFhF_v_6qM0VrP1TT10UTyTWLCfhTirsFcs, enabled=1, isFirstSession=0]
デフォルト   14:50:05.413459+0900    *****   [AppLovinSdk] DEBUG [MARewardedAd] -[MARewardedAd initWithAdUnitIdentifier: de2d7dfb3fb1b31b sdk: [ALSdk: key=ucib6meZCRF8F-PTOM
4mO3Pu5R2GRkCxL1zJGwX2aT0Th1L-pqKLFhF_v_6qM0VrP1TT10UTyTWLCfhTirsFcs, enabled=1, isFirstSession=0]]

We're releasing a new app this weekend that incorporates this SDK, and I'm worried that it will affect our revenue.

takazawa-gg commented 3 weeks ago

The initialization code is written as follows. Most of the time it works fine.

ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: SDK_KEY builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {
    if (enableVerboseLogging) {
        builder.settings.verboseLoggingEnabled = YES;
    }

    if (self.enableConsentFlow) {
        builder.settings.termsAndPrivacyPolicyFlowSettings.enabled = YES;
    }

    if (self.privacyUrl != nil) {
        builder.settings.termsAndPrivacyPolicyFlowSettings.privacyPolicyURL = [NSURL URLWithString: self.privacyUrl];
    }

    if (self.termsUrl != nil) {
        builder.settings.termsAndPrivacyPolicyFlowSettings.termsOfServiceURL = [NSURL URLWithString: self.termsUrl];
    }

    if (self.enableDebugUserGeographyGDPR) {
        builder.settings.termsAndPrivacyPolicyFlowSettings.debugUserGeography = ALConsentFlowUserGeographyGDPR;
    }

    builder.mediationProvider = ALMediationProviderMAX;
}];

[[ALSdk shared] initializeWithConfiguration: initConfig completionHandler:^(ALSdkConfiguration *sdkConfig) {
    [FBAdSettings setAdvertiserTrackingEnabled:YES];

    self.eventDispatcher("didInitializeSdk", "");
}];
takazawa-gg commented 3 weeks ago

We measured the frequency of this symptom on several devices within our company.

Simply start the app, check if a log indicating that SDK initialization has been completed is output, see if you can display an advertising video, and then restart the app again.

I don't know if this verification is meaningful, but I tested it 50 times on each device.

Occurrence probability by device

iPhone 14 Pro (iOS 17.4.1) => 2/50 (4%) (*1)
iPhone 14 Pro (iOS 17.3.1) => 4/50 (8%) (*1)
iPhone XS Max (iOS 17.4) => 5/50 (10%)
iPhone XR (iOS 17.3.1) => 5/50 (10%)
iPhone 11 (iOS 17.4.1) => 17/50 (34%)
iPhone XS (iOS 17.4.1) => 9/10 (83%)

The data shown in (*1) is the same device, but the OS has been updated. At first glance, it seemed like iOS 17.4.1 was the problem, but that doesn't seem to be the case.

Our next step is to try changing the initialization method back to what it was before. If there is no change, I will try reverting to an older version of the SDK.