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?
From the IMA SDK team at Google:
At the moment, I'm afraid we cannot give you support on this as our documentation and the sample app are on the Obj-c version only. A feature request has been made for the IMA SDK for tvOS Swift version. However, I cannot give a definite date on when this will be available.
So we may be stuck coding this part in Objective C for the foreseeable future.
Update from the IMA team which now indicates this is actually a bug in their SDK.
I already raised this to the rest of the team. As per discussion, this seems to be a bug on our SDK side and this has already been relayed to our Engineering team for further investigation. I'll update this thread for any feedback available
As an update my colleague found that adding "tvos" to the bundleID solved the issue. Google has identified the issue on their side and are fixing as well. Details can be found here:
Update 7/31/19:
Google has indicated that they have released the fix for this issue in the latest tvOS SDK.