AppLovin / AppLovin-MAX-SDK-iOS

84 stars 69 forks source link

Test mode doesn't work on device #293

Closed Gargo closed 3 months ago

Gargo commented 3 months ago

MAX SDK Version

12.1.0

Device/Platform Info

iPhone SE 2020, iOS 17.1.1

Current Behavior

Test ads are showing on simulator and doesn't on real device.

Expected Behavior

No response

How to Reproduce

According to your documentation: https://support.applovin.com/hc/en-us/articles/13986987410189-MAX-Test-Mode

let settings = ALSdkSettings()
settings.testDeviceAdvertisingIdentifiers = ["YOUR_IDFA_HERE"]
let sdk = ALSdk.shared(with: settings)!

My code:

        let settings = ALSdkSettings()
        settings.testDeviceAdvertisingIdentifiers = [ASIdentifierManager.shared().advertisingIdentifier.description]
        ALSdk.shared()!.mediationProvider = "max"
        ALSdk.shared(with: settings)?.initializeSdk(completionHandler: { configuration in
              print(configuration)
        })

Additional Info

Test mode on simulator works always. Test mode on real device works if ALSdk.shared()!.mediationProvider = "max" is not called. Could you please provide a correct info how to initialize sdk if I need debug build on a simulator, debug build on real device and release build on real device because currently I must try random combinations of params to achieve it. Documentation has no info about it.

thomasmso commented 3 months ago

[ASIdentifierManager.shared().advertisingIdentifier.description] is not the correct way to retrieve the IDFA.

You have to prompt for it first via:

import AppTrackingTransparency
import AdSupport

ATTrackingManager.requestTrackingAuthorization { status in
    // Handle the authorization status
}

then you can retrieve it using:

let advertisingId = ASIdentifierManager.shared().advertisingIdentifier.uuidString
Gargo commented 3 months ago

@thomasmso you didn't read the issue. I have already assured advertisingId is valid. The problem is with your documenation and/or sdk implementation because this string has influence on test mode: ALSdk.shared()!.mediationProvider = "max" and your documenation doesn't describe how and why to use it or not

thomasmso commented 3 months ago

@Gargo - I think that's a fair point, our docs should do a better job at calling out the functionality of that line. We'll update.

If you're using MAX as the mediation provider, which I assume you are since you're reading our docs, please set it to "max". That way, our SDK will know it's the mediation provider for other mediated adapter(s)/network(s) that you may have integrated into your app.

Gargo commented 3 months ago

@thomasmso do you mean I can't run test mode on a device with mediated adapters/networks?

thomasmso commented 3 months ago

@Gargo - You can. As long as the IDFA is consented to and set correctly, our SDK will display test ads. If you want finer-grain control over testing various mediated networks, you can use our Mediation Debugger.