1

I am using GoogleAds-IMA-iOS-SDK (3.3.1) via Cocoapods to show video ads, Xcode 8.0. This is how I set up the adsLoader. Note I have enableDebugMode = true. This adsLoader is stored in VKSharedAdManager.adsLoader for reuse.

IMASettings *settings = [[IMASettings alloc] init];
settings.ppid = @"IMA_PPID_0";
settings.enableDebugMode = true;
settings.language = kLanguageCodeEnglish;
self.adsLoader = [[IMAAdsLoader alloc] initWithSettings:settings];

Then I make the request with that loader.

IMAAdDisplayContainer *displayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:self.adRequest.adContainer companionSlots:nil];
    self.request = [[IMAAdsRequest alloc] initWithAdTagUrl:adTagUrl adDisplayContainer:displayContainer contentPlayhead:VKSharedAdManager.contentPlayhead userContext:nil];
    VKSharedAdManager.adsLoader.delegate = self;
    DDLogVerbose(@"%@: requesting %@", self, adTagUrl);
    [VKSharedAdManager.adsLoader requestAdsWithRequest:self.request];

The first ads works fine, IMAAdsLoaderDelegate methods are called fine. The IMA loader debug log is as follows. (There are more but this is the beginning...)

2016-12-13 15:35:14.769 MyApp[5835:1419742] Core: (INFO) ima.loader.AdsLoaderWrapper: Requesting ads using new ads loader.
2016-12-13 15:35:14.963 MyApp[5835:1419742] Core: (INFO) ima.loader.AdsLoaderWrapper: requestAds, processing external request.
2016-12-13 15:35:14.964 MyApp[5835:1419742] Core: (INFO) ima.loader.SequentialAdsLoader: Enqueued new request.
2016-12-13 15:35:14.965 MyApp[5835:1419742] Core: (INFO) ima.loader.SequentialAdsLoader: Starting request from queue.
2016-12-13 15:35:15.257 MyApp[5835:1419742] Core: (INFO) ima.loader.AdSourceFetcher: Creating PlaylistSource.
2016-12-13 15:35:15.271 MyApp[5835:1419742] Core: (INFO) ima.loader.AdsLoaderWrapper: dispatchPlaylist_
...
...

Next, I close that video and then play another video. PROBLEM: Now the log just show this and nothing happens.

2016-12-13 15:37:59.266 MyApp[5835:1419742] Core: (INFO) ima.loader.AdsLoaderWrapper: Requesting ads using new ads loader.

Then for all next videos after there's no log at all. If I restart the app, then same thing happen. Only the first ad works. I have tried like 10+ times and there's one lucky time that it will work for all videos. All testing is done on iPad mini device with iOS 9.3.5. I'm not sure what's wrong.

Hlung
  • 13,850
  • 6
  • 71
  • 90

1 Answers1

0

Make sure there is only one instance of IMAAdsLoader throughout the app. Have a look at the official doc: https://developers.google.com/interactive-media-ads/docs/sdks/ios/quickstart

You should maintain only one instance of IMAAdsLoader for the entire lifecycle of your app. To make additional ad requests, create a new IMAAdsRequest object but re-use the same IMAAdsLoader. For more info see our FAQ.

Hope it helps.

atulkhatri
  • 10,896
  • 3
  • 53
  • 89