AppLovin / AppLovin-MAX-Unity-Plugin

110 stars 31 forks source link

NSGenericException Crash when displaying a banner while MediationDebugger or native screen is open. #354

Closed soqman closed 1 month ago

soqman commented 1 month ago

MAX Plugin Version

6.4.2

Unity Version

2022.3.21f

Device/Platform Info

ios 17.4.1 iPhone 13 mini 13

Current Behavior

Fatal Exception: NSGenericException Unable to activate constraint with anchors <NSLayoutXAxisAnchor:0x30067fe80 "MAAdView:0x151b91410.centerX"> and <NSLayoutXAxisAnchor:0x300708d80 "UILayoutGuide:0x30274b720'UIViewSafeAreaLayoutGuide'.centerX"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.

Expected Behavior

No crash

How to Reproduce

  1. Set banner is active,
  2. open MediationDebugger
  3. wait

or

  1. Set banner is active
  2. Show rate us ios native dialog
  3. wait

Additional Info

No response

JonathanLiuApp commented 1 month ago

@soqman We are aware of this issue and will have a fix in the next release. I will update here when the fix is live.

abogarsukov-braingames commented 1 month ago

We experience very similar crash after upgrading to 6.4.2. Attaching the crash report. applovin-ios-crash.zip In our case it randomly crashes when playing an ad.

santoshbagadi commented 1 month ago

We're working on releasing a fix for this shortly. If you wish to add the workaround now, you can do so by replacing this line in Assets/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m file to the following

UILayoutGuide *layoutGuide = superview.window ? superview.window.safeAreaLayoutGuide : superview.safeAreaLayoutGuide;
wangping0214 commented 1 month ago

We're working on releasing a fix for this shortly. If you wish to add the workaround now, you can do so by replacing this line in Assets/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m file to the following

UILayoutGuide *layoutGuide = superview.window ? superview.window.safeAreaLayoutGuide : superview.safeAreaLayoutGuide;

Thank you, it works fine for me.

JonathanLiuApp commented 1 month ago

We've released a fix for this in the latest version of our plugin (6.4.3).

RiverboatGambler commented 2 weeks ago

I'm seeing this error in XCode using 12.4.1

Is it truly fixed or is this a different error?

[AppLovinSdk] DEBUG [ALErrorReporter] storekit_error reported with code 200 and extra parameters {
    "ad_id" = 24628950;
    "ad_size" = INTER;
    "error_message" = "Error Domain=SKANErrorDomain Code=10 \"(null)\"";
    operation = start;
    parameters = "{\"ad_impression_id\":\"d6e94b48-5dfe-4c60-a165-860e50e51b13\",\"ad_network_id\":\"ludvb6z3bs.skadnetwork\",\"ts_s\":1714511968060,\"signature\":\"MDQCGCid/aXHF7cxeUp5OgALow2Q6aV+oN6lzQIYNuBWeY3Mb+zJJk1qbCZxZYn+C0wXI3pV\",\"advertised_app_store_item_id\":0,\"ad_campaign_id\":51,\"version\":\"3.0\",\"source_app_store_item_id\":0}";
    source = SKAdImpression;
}
thomasmso commented 2 weeks ago

@RiverboatGambler - Your error is different than the original issue. However, I am curious of your error message, are you able to easily reproduce that upon showing interstitial ads from AppLovin?

RiverboatGambler commented 2 weeks ago

Yes. It happens everytime I display a Test Reward Ad on a Simulator in XCode. I don't know why AppLovin would care anything about storekit. I am only serving bid ads through AdMob.

It happens immediately after: "AppLovinAdapter: Rewarded ad playback began", while the ad is being played

Screenshot 2024-05-01 at 12 06 11 PM
thomasmso commented 2 weeks ago

@RiverboatGambler - Got it, yeah that's fine. It's an error that is isolated to simulators only. We'll remove the error logs in an upcoming SDK release, thanks for reporting it nonetheless and let us know if anything else arises.