У меня возникает следующая ошибка подключения при попытке загрузить промежуточную рекламу AdMob:
[NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x281e14840, domain=1, instance=1>
Идея в том, чтобы показывать рекламу каждый раз при загрузке viewcontroller.Реализация основана на учебнике Google .Для моего applicationID пробовал и мой, и Google тестовый.
Мой AppDelegate.swift
:
import UIKit
import GoogleMobileAds
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// Initialize the Google Mobile Ads SDK.
GADMobileAds.configure(withApplicationID: "ca-app-pub-3940256099942544~1458002511") \\ google's test ID
return true
}
Расширение моего viecontroller:
extension MenuViewController: GADInterstitialDelegate {
func createAndLoadInterstitial() -> GADInterstitial {
let interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910") \\ google's test ID
interstitial.delegate = self
interstitial.load(GADRequest())
return interstitial
}
func interstitialDidDismissScreen(_ ad: GADInterstitial) {
interstitial = createAndLoadInterstitial()
}
func showAd() {
if interstitial.isReady {
interstitial.present(fromRootViewController: self)
} else {
print("Ad wasn't ready")
}
}
}
И мойпозвоните viewdidload
:
override func viewDidLoad() {
super.viewDidLoad()
// Ads
interstitial = createAndLoadInterstitial()
showAd()
...
Мой полный журнал:
2019-01-25 19:46:06.192791+0100 TimerApp[9118:2416519] [DYMTLInitPlatform] platform initialization successful
2019-01-25 19:46:06.488342+0100 TimerApp[9118:2416370] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2019-01-25 19:46:06.489723+0100 TimerApp[9118:2416370] [MC] Reading from public effective user settings.
Ad wasn't ready
2019-01-25 19:46:07.492398+0100 TimerApp[9118:2416505] [NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x282ac4ce0, domain=1, instance=1>
2019-01-25 19:46:07.745157+0100 TimerApp[9118:2416370] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)
2019-01-25 19:46:07.755242+0100 TimerApp[9118:2416505] <Google> To get test ads on this device, call: request.testDevices = @[ @"7df8e261fcfdb632b0663a3e42407e21" ];
2019-01-25 19:46:07.939245+0100 TimerApp[9118:2416540] WF: === Starting WebFilter logging for process TimerApp
2019-01-25 19:46:07.939302+0100 TimerApp[9118:2416540] WF: _userSettingsForUser mobile: {
filterBlacklist = (
);
filterWhitelist = (
);
noOverridingAllowed = 1;
restrictWeb = 1;
useContentFilter = 0;
useContentFilterOverrides = 0;
whitelistEnabled = 0;
}
2019-01-25 19:46:07.939346+0100 TimerApp[9118:2416540] WF: _WebFilterIsActive returning: NO
2019-01-25 19:46:10.210927+0100 TimerApp[9118:2416370] Warning: Attempt to present <TimerApp.SettingsViewController: 0x104841450> on <TimerApp.MenuViewController: 0x105023400> which is already presenting <TimerApp.SettingsViewController: 0x10483cb40>
2019-01-25 19:46:11.557808+0100 TimerApp[9118:2416370] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)