adform / adform-ios-sdk

adform-ios-sdk
MIT License
8 stars 8 forks source link

Ad is not loaded #18

Closed nharbo closed 6 years ago

nharbo commented 7 years ago

Hi guys! I've implemented your SDK, and when I request an ad, i get this error:

Cannot show the ad view: >, ad is not loaded! I'm using swift, and the way I load the ad is like this: ``` let adView = AFAdInline(masterTagId: 272633, presenting: self)! adView.delegate = self adView.loadAd() adView.showAd() ``` It's strange, as I managede one time to get an ad shown - but only once! What do I need more, to load this ad? I'm using DFP mediation, and that's why I'm not adding anything to a subview etc.. But it seems like the ad isn't loaded at all. Looking forward to hear from you :-)
nharbo commented 7 years ago

Also my delegate methods aren't running - even though I set the adView.delegate = self .. (My class implements the AFAdInlineDelegate protocol :-))

vladasdrejeris commented 7 years ago

Hello,

First of all, you are getting the error because you are calling the adView.showAd() method before the ad is loaded. In most cases you don't need to use this method, because the ad is displayed automatically.

Secondly, if you are using DFP mediation you don't need to create ad views directly, ad view creation is managed by mediation library.

Looks like your mediation integration is incorrect.

nharbo commented 7 years ago

Hi @vladasdrejeris

So, it seems like the ad never loads. And yes, because of that, the adView.showAd() is not needed - i understand :-)

I use DFP yes, and as I understood, I should just load the ad, and then DFP will catch it, and display it in my DFP-adview. But I never get the ad loaded - shouldn't the code I've provided, be enough to load an ad? I know that the masterTag is working, but if I'm missing anything, please enlighten me ;-) I can send you the code/project if you want?

vladasdrejeris commented 7 years ago

You are not correct about DFP mediation. It works differently. The DFP mediation library provided by Adform (you can find it here), creates ad views internally and passes them to DFP adview. You don't need to create an adInline view yourself.

Code/project would help, it will let us understand your integration better, please send it.

nharbo commented 7 years ago

Here's my code @vladasdrejeris https://github.com/nharbo/ConceptApp

The classes which are being used are: Dfp320x320.swift and AdformCustomEventBanner.swift (you can find them in https://github.com/nharbo/ConceptApp/tree/master/concept-ios)

Thanks for the link - I'm not 100% sure, but I think I've done everything it says - I already implemented the AdformAdvertisingDFPAdapter, and I also use the masterTag - but maybe I'm calling for the ad in a wrong way? :-)

Thanks for your time!

nharbo commented 7 years ago

I tried to add the libAdapterAdformAdvertising.a in the "Link Binary With Libraries", and get this error: ld: warning: ignoring file /Users/nicolaiharbo/Desktop/ConceptApp/concept-ios/AdformAdvertisingDFPAdapter/libAdapterAdformAdvertising.a, missing required architecture arm64 in file /Users/nicolaiharbo/Desktop/ConceptApp/concept-ios/AdformAdvertisingDFPAdapter/libAdapterAdformAdvertising.a (2 slices)

So I'm not even sure, that the adapter is recognized? It seems like it's not compiled in a 64-bit compatible version:)

vladasdrejeris commented 7 years ago

Hello,

Sorry for the late reply. I have checked your integration sample and found a few issues. First, you should download the newest version of Adform DFP adapter 1.0.2. Second, you should change the Custom Event class name to AdformCustomEventBanner (without the concept_ios prefix) in DFP UI. Try to fix these issues, it should solve the ad loading problem.

nharbo commented 6 years ago

@vladasdrejeris So... What you're suggesting is the complete opposite of what the DFP support suggested me :-) They specifically told me to add the concept_ios-prefix - and when I had it, the Custom Event were recognized - after doing what you said, I'm back at this: concept-ios[11138:3193390] <Google> Cannot find Custom Event class named AdformCustomEventBanner.

So I'm pretty sure the prefix has to be there.. But I'm back to where I was when I created this ticket in the first place :-) Do you have any other ideas of how to fix this? I think what I need, is to load the ad properly, in the AdformCustomEvent-class. I'm changing it back to have the prefix in DFP, otherwise I cant see how it should be possible to catch the CustomEvent when DPF's sending it.

Is this the first time, someone asking this, for a Swift project? :-) Someone must have done this before..

vladasdrejeris commented 6 years ago

Hello,

About the prexif, it is needed for Swift classes. Previously you were using your own implementation of AdformCustomEventBanner, that was in Swift, that's why you needed the prefix. Our static library is coded in Objective-C so the prefix is not needed.

I will take a look why AdformCustomEventBanner class may not be found.

vladasdrejeris commented 6 years ago

I have just tried to load ads in the modified sample project that you provided and I am not getting the error that you are getting. I can see that AdformAdvertising SDK is being called by DFP and it is loading the ad, but it fails because there is no ad to show, it may be some targeting issues here, but the integration part is correct. You can see it from this error, that is fired from AdformAdvertising SDK: <error> Error Domain=AFErrorDomain Code=5 "Request Error: No ad to show." UserInfo={NSLocalizedDescription=Request Error: No ad to show.} Try to double check if you have correctly imported and linked the libAdapterAdformAdvertising library to the project. I am also attaching the modified sample project that works correctly. https://we.tl/9rm2iU155S

nharbo commented 6 years ago

Hi @vladasdrejeris

Thanks! So from what you say, it's something about the settings in DFP? :-) I think we has a masterTag from you guys, that were supposed to spit out ad's, but maybe I misunderstood something. I actually thought that error came from the DFP integration. But awesome that you think it looks right - or, that it's right now at least :)

vladasdrejeris commented 6 years ago

This error: Error Domain=AFErrorDomain Code=5 "Request Error: No ad to show." UserInfo={NSLocalizedDescription=Request Error: No ad to show.} Basically means that everything was ok, SDK got a successful response from server, but the ad exchange server didn't find any ad that could be shown. Usually its a problem with parameters on Adform portal or maybe on DFP side, the ad size may be incorrect, targeting parameters or something like that.

nharbo commented 6 years ago

@vladasdrejeris - I'm still struggling with this one - I have the master-tag 494067 - one of your colleagues gave it to me, for testing, so I'm not sure if it returns what's expected. Can you tell me if the tag delivers ads as expected?

nharbo commented 6 years ago

@vladasdrejeris :)?

vladasdrejeris commented 6 years ago

Hello,

Sorry for late reply, looks like that tag 494067 doesn't load ads. Something must be configured incorrectly for it on Adform site.

One more thing, are you still using DFP mediation? Because I tried running the sample app you provided earlier and saw that DFP is trying to load concept_ios.AdformCustomEventBanner prefixed class once more, you should use Adform DFP adapter provided by Adform and load it without the class prefix.

nharbo commented 6 years ago

No worries :) Hmm, okay! Do you have a demo-tag that I can try and use, to be sure it's set up in the right way? I'm using the project you sent me, where you changed things a little :) But maybe the mediation is sending it wrong still - should it just be AdformCustomEventBanner, without the prefix?

vladasdrejeris commented 6 years ago

Yes, you can try this tag 142493 from our sample application, adSize 320 x 250. And yes, make sure to set the AdformCustomEventBanner class without the prefix.