Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS][AdManager][Banner] An ad is not rendered properly #189

Merged
merged 13 commits into from
Jun 18, 2019

Conversation

yoalex5
Copy link
Collaborator

@yoalex5 yoalex5 commented May 10, 2019

Issue #175

API:

func findPrebidCreativeSize(_ adView: UIView, completion: @escaping (CGSize?) -> Void)

Example:

func adViewDidReceiveAd(_ bannerView: GADBannerView) {
    print("adViewDidReceiveAd")
        
    Utils.shared.findPrebidCreativeSize(bannerView) { (size) in
        if let bannerView = bannerView as? DFPBannerView, let size = size {
            bannerView.resize(GADAdSizeFromCGSize(size))
        }
     }
}

@yoalex5 yoalex5 changed the title [AdManager][Banner] An ad is not rendered properly [iOS][AdManager][Banner] An ad is not rendered properly May 10, 2019
@@ -108,6 +108,9 @@ class BannerController: UIViewController, GADBannerViewDelegate, MPAdViewDelegat

func adViewDidReceiveAd(_ bannerView: GADBannerView) {
print("adViewDidReceiveAd")

self.dfpBanner.resize(bannerView.adSize)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be documented here http://prebid.org/prebid-mobile/pbm-api/ios/pbm-bannerad-ios.html to include adManager and the implementation logics like these to address specific mediation partner issues

Copy link

@can-soykarafakili can-soykarafakili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix seems to be fine. 👍 I agree with @ppuviarasu 's comment as well.

@yoalex5
Copy link
Collaborator Author

yoalex5 commented May 29, 2019

The latest update to PR has the next logic:

  1. When AdManager SDK retrieves a creative (adViewDidReceiveAd event) a client app calls Utility method findPrebidCreativeSize that is looking for hb_size key/value in the creative js code.
  2. findPrebidCreativeSize calls Completion Handler that contains CGSize parameter with a value if the hb_size key/value has been found and nil in other cases

Please note that it is Utility function that is supposed to call it from the client code when it is necessary


func findSizeInWebViewAsync(uiWebView: UIWebView, completion: @escaping (CGSize?) -> Void) {

Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { (timer) in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API only works for iOS 10 & above and not for iOS 9. Since we are downgrading to iOS 9, can you fix this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will upgrade the PR.

@yoalex5
Copy link
Collaborator Author

yoalex5 commented Jun 14, 2019

@ppuviarasu, I have updated the PR.
On Tuesday I am going to make full testing using different AdManagerSDK versions

@yoalex5
Copy link
Collaborator Author

yoalex5 commented Jun 18, 2019

@ppuviarasu, I have finished sanity checks and it seems that it is workable fix. Could you please review this PR?

@bretg
Copy link
Contributor

bretg commented Jun 25, 2019

docs PR prebid/prebid.github.io#1352

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants