iOS - Admob

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

iOS - Admob

Post by LunaRebirth »

Has anyone accomplished how to do this?

I have downloaded the Admob test example from https://github.com/firebase/quickstart- ... ob/testapp.
The example displays the ads perfectly fine.

However, while trying to implement the ads with Irrlicht, it doesn't seem to want to work.

The moment I switch from using the example's AppDelegate class to Irrlicht's CIrrDelegateiOS class, I get the error

Code: Select all

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
I've followed every single page online that talks about how to solve the above error, but nothing works (such as adding NSAllowArbitraryLoads).

I think the problem is that I am using the wrong view (window context) when implementing a banner.
For example,

Code: Select all

banner->Initialize(getIrrlichtView(), kBannerAdUnit, banner_ad_size);
I modified the Irrlicht source to include the function getIrrlichtView() which returns the dataStorage->View from CIrrDeviceiOS::createViewAndDriver().

If anyone could help me figure out what view to use, or if that's even the issue, I would be forever thankful. This has been bothering me for the past few days.

I've put together an example project if anyone wants the source.
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: iOS - Admob

Post by LunaRebirth »

I am still unable to get this to work, if anyone has any ideas what I should try
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: iOS - Admob

Post by Nadro »

Hello,

I'm not sure that this issue is related to a wrong view, please check project settings and info.plist and compare those between your Irrlicht based app and AdMob example. However if issue is related to a wrong UIView I think that a following solution may help:
1. Create UIView dedicated to Ad banner (it's just like a container)
2. Add created UIView to Irrlicht (use frame for positioning this view instead of constraints) view eg:

Code: Select all

[getIrrlichtView() addSubview:createdViewForBanner];
3. Attach AdMobBanner view to created view in the 1st step
I will be offline until next friday, so if this solution will not work I will not be able to help you in the upcoming few days.

BTW. You can also tell to Irrlicht to which view engine should attach own rendering view (by default Irrlicht will create own UIWindow, UIApplicationDelegate etc, but you can provide your own objects), so it's possible even to prepare Irrlicht based widged in a standard iOS app.

Cheers,
Patryk
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: iOS - Admob

Post by LunaRebirth »

Thanks Nadro, unfortunately I had already tried both of your suggestions, and I'm not seeing any progress.

I actually took the AdMob example and merged the Irrlicht iOS example together -- kept everything 100% the same. As soon as I switch between using Irrlicht's delegate method through

Code: Select all

UIApplicationMain(argc, argv, 0, NSStringFromClass([CIrrDelegateiOS class]));
to the AdMob example's delegate method through

Code: Select all

UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
the ads no longer load, and I receive the error posted above.

Likewise, I took only the parts of the AdMob example I should care about (the UIView) and created a project using the Irrlicht iOS example. It also failed. Looks like something in the delegates are possibly conflicting? I have tried several ways of merging the projects together, to no success.

Have you successfully completed this task? I would be quite interested in seeing someone else actually get it to work.
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: iOS - Admob

Post by LunaRebirth »

I got it to work :-)
I'm not exactly sure what I was doing wrong previously, but I retried my steps in the CIrrDeviceiOS.mm file and it worked fine.
Thank you!
Post Reply