2017-06-01 35 views
0

我正在使用Xamarin Forms平臺的iOS應用程序。我使用谷歌AdMob和實現它下面這個網址http://motzcod.es/post/154696375922/xamarinforms-google-admob-ads-in-iosGoogle AdMob不適用於Xamarin Form iOS,適用於iPhone 7和7 Plus等大屏幕設備

它的工作原理每個設備和模擬器的iOS版本上的完美罰款10.2

它還適用於IOS版本10.3,但只有像iPhone 5S和更少的器件5c,但不適用於iPhone 6,6s,6s Plus,7,7 Plus的設備和模擬器

進一步調試時會出現以下錯誤,「Error Domain = com.google.ads Code = 13」請求錯誤:收到無效響應。「UserInfo = {NSLocalizedDescription =請求錯誤:收到無效響應。,NSLocalizedFailureReason =請求錯誤:收到無效響應。}」

我搜索了這個錯誤並且應用了一個修復程序,但那不起作用。

我很感激,如果有人可以請幫助。由於

+0

我可能會被誤解,但我相信現在需要在後來的iOS版本的URL是'https'而不是'http' – Digitalsa1nt

+0

嗨在那裏,爲了運行一個關鍵NSAppTransportSecurity必須添加我已經我第一次運行這個項目。 –

+0

有人可以幫助嗎?我在同一個問題上運行。 – Supreet

回答

0
You may want to try [App Transport Security][1] and add the following lines to the info.plist. 

<key>NSAppTransportSecurity</key><dict> 
<key>NSAllowsArbitraryLoads</key> 
<true/></dict> 

This may resolve your problem. 

    [1]: https://developers.google.com/admob/ios/app-transport-security 
+0

你好,謝謝你的回覆。我第一次運行項目時已經添加了這些鍵。 –

0

只是FYI我跟着這個博客http://motzcod.es/post/154696375922/xamarinforms-google-admob-ads-in-ios

BannerView是iOS中的自定義呈現這樣使用

 adView = new BannerView(size: AdSizeCons.SmartBannerPortrait, 
             origin: new CGPoint(0, UIScreen.MainScreen.Bounds.Size.Height - AdSizeCons.Banner.Size.Height)) 
     { 
      AdUnitID = bannerId, 
      RootViewController = GetVisibleViewController() 
     }; 

而不是使用參數的構造函數創建的對象,只需創建它像此

 adView = new BannerView() 
     { 
      AdUnitID = bannerId, 
      RootViewController = GetVisibleViewController() 
     }; 

Above implement a它解決了所有iOS版本和設備中的問題。

相關問題