Skip to content

DisplayViewLoadingDelegate fires displayViewDidLoadAd with empty view #1220

@MattMur

Description

@MattMur

Describe the bug
I'm writing a custom renderer, trying to leverage as much of the existing architecture as possible. However currently the DisplayView fires the DisplayViewLoadingDelegate protocol displayViewDidLoadAd with an empty view (DisplayView has no ad, or subviews). This is counter-intuitive and feels like a bug considering that if the ad truly did load, then it should not be empty.

It seems the source of the problem initiates from the method onTransactionIsReady: where both setupCreative: and adViewManagerDelegate adLoaded: are both dispatched async to the main thread. However later down the line in the method show: at the point where the actual creative view gets injected into the DisplayView, it for some reason again dispatches to the main thread. The problem is that by moving the creative insertion to the top of the call stack with dispatch_async, it preempts displayViewDidLoadAd and causes it to be called first, before the method show has actually finished loading the ad.

To Reproduce
Steps to reproduce the behavior:

  1. Set breakpoint on 'BannerAdLoader' line 77
  2. Run PrebidDemoSwift with In-App Display Banner rendering
  3. See that displayView is empty, not loaded

Expected behavior
Parameter displayView: UIView subviews should not be empty. displayView should contain a PBMWebView.

Smartphone (please complete the following information):

  • Device: iPhone 17
  • OS: 26

Solutions
The best option to me would be to simply postpone the call to [self.adViewManagerDelegate adLoaded:[transaction getAdDetails]] and instead call it after the creative has been injected on line 120.
Another solution would be to remove the extra call to dispatch_async from show:. It's not clear to me why this extra dispatch is needed considering that the it's already executing on the main thread. Simply removing it solved my problems during my tests, but I'm not fully aware of the implications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions