I am using the GoolgeInteractiveMediaAds
framework in tvOS. At the very beginning of the process I am getting an error from the delegate that says: Error loading ads: nil
. I have also loaded the sample Google project, written in Objective C, which runs with no errors. There is extremely little code at this stage and I have compared the two projects and see no differences that matter in terms of the AppDelegate
and Info.plist
(the only difference is the Swift project kicks off from a storyboard).
The below is the sum total of the code. When run setUpAdsLoader
immediately hits the error delegate you see at bottom. Cutting back their sample Objective C project to just these lines, does not produce this error.
import UIKit
import GoogleInteractiveMediaAds
class ViewController: UIViewController, IMAAdsLoaderDelegate {
private var adsLoader: IMAAdsLoader?
override func viewDidLoad() {
super.viewDidLoad()
setUpAdsLoader()
}
func setUpAdsLoader() {
self.adsLoader = IMAAdsLoader(settings: nil)
self.adsLoader!.delegate = self
}
func adsLoader(_ loader: IMAAdsLoader!, adsLoadedWith adsLoadedData: IMAAdsLoadedData!) {
// Grab the instance of the IMAAdsManager and set ourselves as the delegate
//adsManager = adsLoadedData.adsManager
//adsManager!.delegate = self
// Create ads rendering settings and tell the SDK to use the in-app browser.
let adsRenderingSettings = IMAAdsRenderingSettings()
adsRenderingSettings.webOpenerPresentingController = self
// Initialize the ads manager.
//adsManager!.initialize(with: adsRenderingSettings)
}
func adsLoader(_ loader: IMAAdsLoader!, failedWith adErrorData: IMAAdLoadingErrorData!) {
print("Error loading ads: \(String(describing: adErrorData.adError.message))")
}
}
Update: I created the same test project but this time did it using Objective C. Worked without error. Hard to believe the issue is the language but I wonder if there are any Xcode settings differences between the two languages that would lead to this?