googleads / googleads-ima-tvos-client-side

5 stars 8 forks source link

IMAAdsLoader Error code 1010 (kIMAError_FAILED_LOADING_AD) #4

Closed KamilGrotowski closed 5 years ago

KamilGrotowski commented 5 years ago

I created really simple application in swift that uses your library. On viewDidLoad I created IMAAdsLoader object using method below:

    func setupAdsLoader() {
        adsLoader = IMAAdsLoader(settings: nil)
        adsLoader.delegate = self
    }

and I added IMAAdsLoaderDelegate protocol implementation:

extension ViewController: IMAAdsLoaderDelegate {
    func adsLoader(_ loader: IMAAdsLoader!, adsLoadedWith adsLoadedData: IMAAdsLoadedData!) {
        print("success")
    }

    func adsLoader(_ loader: IMAAdsLoader!, failedWith adErrorData: IMAAdLoadingErrorData!) {
        print("error \(adErrorData.adError.code.rawValue)")
    }
}

I was keep getting error 1010 so I tried to investigate what is causing the issue. I have noticed that my web inspector attached to the Apple TV was throwing errors on console:

TypeError: a.createElement is not a function. (In 'a.createElement(c)', 'a.createElement' is undefined) in He -- native_bridge__en.js:2119. After some time I noticed that the lib checks if UserAgent contains phrase "AppleTV" or "tvOS":

        var xt = function() {
            var a = Pb;
            return Mb(a, "AppleTV") || Mb(a, "tvOS")
        }

        Mb = function(a, b) {
            return -1 != a.toLowerCase().indexOf(b.toLowerCase())
        }

Unfortunately my UserAgent does not contains those phrases:

"com.AdTest/1.0 (Apple TV; CPU OS 12_3 like Mac OS X)"

And your sample works only because you have phrase tvos in you bundle id!

"com.google.ima.tvos.clientSide.BasicExample/1.0 (Apple TV; CPU OS 12_3 like Mac OS X)"

Could you please fix it so everybody could use your lib? My app is already on store so I can't add tvos to the bundle id :(

gschoppe commented 5 years ago

Hi Kamil,

I'm sorry you ran into this issue before we managed to roll out a fix. We have a fix prepared which is currently working its way through our release process. Since it effects the hosted components of the IMA SDK, you should not need to update your app once the fix goes live, so long as you are on an SDK version newer than 4.0.0.

If you are still using the 1.x version of our client-side SDK, unfortunately you will have to update your app to use the new 4.x combined SDK.

Sorry again for the hassle. I'll update and close this thread as soon as the fix officially goes live.

gschoppe commented 5 years ago

Hi Kamil,

Just a quick update. We released the fix for this bug yesterday, and you should now no longer have any limit on what ID you use in your tvOS app.

Thanks for reaching out to us.