Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么显示谷歌插页广告会改变我导航栏的高度?Xcode 11.3,iOS 13_Ios_Swift_Xcode_Admob_Uinavigationbar - Fatal编程技术网

为什么显示谷歌插页广告会改变我导航栏的高度?Xcode 11.3,iOS 13

为什么显示谷歌插页广告会改变我导航栏的高度?Xcode 11.3,iOS 13,ios,swift,xcode,admob,uinavigationbar,Ios,Swift,Xcode,Admob,Uinavigationbar,每当用户点击打印按钮时,我都试图在我的应用程序中显示一条插页广告——但在取消了广告后,我的导航栏的高度从44增加到96(在iPhone 11 Pro Max物理测试设备上)。iPhone8和iPhone11Pro-Max的模拟器中都出现了相同的行为 我想知道为什么会发生这种情况,以及如何防止这种情况发生。 在高度变化的同时,日志(见下文)中会出现一条警告消息,但我不确定该警告是否与我的导航栏问题有关(或如何防止)。广告显示成功 如果我设置“myProfile.disableds=true”,则下

每当用户点击打印按钮时,我都试图在我的应用程序中显示一条插页广告——但在取消了广告后,我的导航栏的高度从44增加到96(在iPhone 11 Pro Max物理测试设备上)。iPhone8和iPhone11Pro-Max的模拟器中都出现了相同的行为

我想知道为什么会发生这种情况,以及如何防止这种情况发生。 在高度变化的同时,日志(见下文)中会出现一条警告消息,但我不确定该警告是否与我的导航栏问题有关(或如何防止)。广告显示成功

如果我设置“myProfile.disableds=true”,则下面显示的displayInterstitutionAlad()函数不会运行,广告不会显示,导航栏高度也不会更改

这是我的密码:

    func createAndLoadInterstitial() -> GADInterstitial {
        var interstitial = GADInterstitial(adUnitID: adUnitInterstitialID)
        interstitial.delegate = self
        interstitial.load(GADRequest())
        print("Loading interstitial...")
        return interstitial
    }

    func displayInterstitialAd() {
        if interstitial.isReady && myProfile.disableAds == false {
            print("Debug:  Interstitial:  NavBarFrame: \(navigationController?.navigationBar.frame)")
            interstitial.present(fromRootViewController: self)
            print("Debug:  Interstitial:  NavBarFrame: \(navigationController?.navigationBar.frame)")
        }
    }


    func interstitialDidDismissScreen(_ ad: GADInterstitial) {
        print("Debug:  InterstitialDelegateDidDismiss:  NavBarFrame: \(navigationController?.navigationBar.frame)")
        print("interstitialDidDismissScreen")
        interstitial = createAndLoadInterstitial() 
    }
以下是输出:

Print Button tapped...Showing interstitial ad...
Debug:  Interstitial:  NavBarFrame: Optional((0.0, 44.0, 414.0, 44.0))
interstitialWillPresentScreen
Debug:  InterstitialDelegateWillPresent:  NavBarFrame: Optional((0.0, 44.0, 414.0, 44.0))
Debug:  Interstitial:  NavBarFrame: Optional((0.0, 44.0, 414.0, 44.0))
interstitialWillDismissScreen
2020-01-23 08:36:16.387071-0500 MyApp[53938:23813577] [View] First responder error: non-key window attempting reload - allowing due to manual keyboard (first responder window is <UIWindow: 0x101c4ca10; frame = (0 0; 414 896); hidden = YES; gestureRecognizers = <NSArray: 0x28380a880>; layer = <UIWindowLayer: 0x2836f10a0>>, key window is <UIWindow: 0x101c26b50; frame = (0 0; 414 896); gestureRecognizers = <NSArray: 0x2838e9860>; layer = <UIWindowLayer: 0x28368a8a0>>)
Debug:  InterstitialDelegateDidDismiss:  NavBarFrame: Optional((0.0, 44.0, 414.0, 96.0))
interstitialDidDismissScreen
Loading interstitial...
点击打印按钮…显示填隙广告。。。 调试:间隙:NavBarFrame:可选((0.0,44.0,414.0,44.0)) 间隙显示屏幕 调试:InterstitialDeleteGateWillPresent:NavBarFrame:可选((0.0,44.0,414.0,44.0)) 调试:间隙:NavBarFrame:可选((0.0,44.0,414.0,44.0)) 间质细胞分裂筛 2020-01-23 08:36:16.387071-0500 MyApp[53938:23813577][View]第一响应程序错误:非按键窗口尝试重新加载-由于手动键盘允许(第一响应程序窗口为,按键窗口为) 调试:InterstitualDelegateDidDismission:NavBarFrame:可选((0.0,44.0,414.0,96.0)) 间质脱细胞筛选 正在加载填隙。。。
这花了好几天时间,但我还是算出了

在取消了莫代尔全屏插播广告后,我的导航栏又重新生成了。My viewDidLoad已为NavigationBar.appearance()设置了“prefersLargeTitles=true”。我(错误地)认为这已经应用于导航栏,但显然它只适用于新生成的导航栏。 这就是高度意外变化的原因。完全是我的错。很抱歉浪费大家的时间