我試圖做幾天,但仍然無法做到。我試圖找到一些樣本,但它們都在Android上。有沒有人成功整合iOS上的admob?在iOS應用程序中使用monogame集成Admob
4
A
回答
2
我從monotouch-bindings存儲庫中獲得AdMob bindings的一些問題。但後來我切換到AlexTouch.GoogleAdMobAds綁定,他們工作得很好。您可以在Github上的README中找到使用AlexTouch.GoogleAdMobAds的示例。這很簡單,但如果你需要一些幫助 - 隨時提出更詳細的問題。
0
// code for admob "using AlexTouch.GoogleAdMobAds"
UIViewController vc = new UIViewController();
UIViewController controller = UIApplication.SharedApplication.Windows [0].RootViewController;
var ad = new GADBannerView (GADAdSizeCons.SmartBannerLandscape, new PointF (0, 0))
{
AdUnitID = "ADMOB_ID",
RootViewController = vc
};
ad.Hidden = false;
ad.DidReceiveAd += delegate {
ad.Hidden = false;
ad.Frame = new System.Drawing.RectangleF (0, (int) 0, (int) (ad.Bounds.Width), (int) (ad.Bounds.Height));
Console.WriteLine ("AD Received");
};
ad.DidFailToReceiveAdWithError += delegate(object sender, GADBannerViewDidFailWithErrorEventArgs e) {
ad.Hidden = true;
Console.WriteLine (e.Error);
};
ad.WillPresentScreen += delegate {
Console.WriteLine ("showing new screen");
};
ad.WillLeaveApplication += delegate {
Console.WriteLine ("I will leave application");
};
ad.WillDismissScreen += delegate {
Console.WriteLine ("Dismissing opened screen");
};
ad.UserInteractionEnabled = true;
vc.View.AddSubview(ad);
vc.View.Frame = new System.Drawing.RectangleF(0f, 0f, (int)(ad.Bounds.Width), (int)(ad.Bounds.Height));
controller.View.AddSubview(vc.View);
Task.Factory.StartNew(() => {
while (true)
{
Console.WriteLine("Requesting Ad");
InvokeOnMainThread (delegate {
GADRequest r = new GADRequest();
ad.LoadRequest(r);
});
System.Threading.Thread.Sleep(30000);
}
});
相關問題
- 1. AdMob集成在iPhone應用程序上?
- 2. AdMob與我的應用程序集成
- 3. 在ios應用程序中集成googleDrive
- 4. XlsLib在IOS應用程序中集成
- 5. 在我的應用程序中集成Admob
- 6. 在iOS應用中使用AdMob
- 7. 將AdMob集成到Android應用程序中的問題
- 8. 已將iPhone AdMob集成到應用程序中
- 9. AEM- IOS應用程序集成
- 10. iOS應用程序與硬件集成
- 11. IOS應用程序與facebook的集成
- 12. ios應用程序的Twitter集成
- 13. 將gmail與ios應用程序集成
- 14. iOS設置應用程序集成
- 15. Ios應用程序和TestFlight集成
- 16. iOS集成照片應用程序
- 17. OpenFeint與iOS應用程序集成
- 18. Youtube與iOS應用程序集成。
- 19. iOS應用程序在使用Admob時崩潰
- 20. 在iOS中集成一個應用程序與其他應用程序
- 21. 在Cocos2dx v3中集成Admob iOS
- 22. 微博集成在iOS 6和Google集成在iOS 6應用程序
- 23. 將admob sdk集成到iOS應用程序時出現鏈接器錯誤
- 24. Spring集成:多個應用程序集成使用Spring集成
- 25. Admob和與Android應用程序的placeplay集成
- 26. 將應用程序與AdMob集成到公共github
- 27. MonoGame - 對Microsoft.Phone程序集的引用
- 28. 採訪 - 使用iOS應用程序集成C++庫
- 29. iOS應用程序Facebook集成 - iOS 5.0的備用
- 30. 由Android的Pygame子集製作的Android應用程序中的Admob集成
非常感謝您,我使用了AlexTouch.GoogleAdMobAds,我將在稍後粘貼我的代碼。 – user1908944
很高興我的綁定爲你們倆工作:) – dalexsoto
謝謝你。 XD – user1908944