I have a simple quiz page on my website that's setup with Google Adsense Ads.
The ads work fine on the desktop and also in Safari when you type in the URL in Safari on the iOS Device.
I did setup a simple iOS app with a UIWebView
to run the quiz as an app.
The UIWebView
URL is loaded via this code:
if let url = URL(string: "http://itrafikk.net/itrafikkads/") {
webView.loadRequest(URLRequest(url: url))
}
and
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
if let url = request.url, navigationType == UIWebViewNavigationType.linkClicked {
UIApplication.shared.openURL(url)
return false
}
return true
}
Originally I thought it was an issue with NSAppTransportSecurity
/ NSExceptionDomains
but Google uses an SSL certificate for their Google Ad Services so that shouldn't be the problem.
Any ideas on what might be causing this?
The problem is you can't use AdSense for mobile apps. It will work fine in the mobile web browser, however in a mobile application the add will be disable or hidden.
Using AdSense ads in a mobile application is also a violation of AdSense TOS / Policies so I would recommend you avoiding this at any cost.
https://support.google.com/adsense/answer/3394713?hl=en&ref_topic=1250104#2
View the last question in the Part 2: Ad implementation section.