1 decade ago by richardelms
Hi Guys
After some troubles I finally worked out how to use Chartboost with Ejecta today using the great Ob-C extension features built into the wrapper by Dominic.
I'm sure there are better ways to get it perfect, but here is how i got it working.
Please feel free to suggest improvements in the comments.
1: After creating your CB account etc, download the latest CB SDK (I got it working with 4.2).
2: Follow the basic integration settings here: link.
After dragging the chartboost folder into your Ejecta Xcode project you might come up against a linker error in XCode when you try to build. To fix this simply go to Build Phases>Link Binary With Libraries and drag the libJavaScriptCore.a to the top of the list. The clean and build, it should work fine.
3: In Xcode go to File> New File> Objective-C class. Call it 'EJBindingShowCB' and make it a subclass of EJBindingBase.
Make sure to save the new class in your Source>Ejecta folder.
This will create 2 files in that folder.
EJBindingShowCB.h and EJBindingShowCB.m
4: Edit EJBindingShowCB.h to look like this:
5: Edit EJBindingShowCB.m to look like this:
6: Now call the following init somewhere in your ImpactJS code (The Main Game init for example):
7: Then just call the following whenever you want to show an Ad:
Note: In CB, a named location is just a way for you to have more control over where you show ads in your game. For example, you could create a named location called "MainMenu", then in your Chartboost publishing campaign you can specify how often you show Ads in the MainMenu.
That should be it.
Full Disclosure: I currently work at Chartboost
Extra Disclosure: I love ImpactJS :D
Here is the CB helpsite with all the info you need to get started using Chartboost:https://help.chartboost.com/
After some troubles I finally worked out how to use Chartboost with Ejecta today using the great Ob-C extension features built into the wrapper by Dominic.
I'm sure there are better ways to get it perfect, but here is how i got it working.
Please feel free to suggest improvements in the comments.
1: After creating your CB account etc, download the latest CB SDK (I got it working with 4.2).
2: Follow the basic integration settings here: link.
After dragging the chartboost folder into your Ejecta Xcode project you might come up against a linker error in XCode when you try to build. To fix this simply go to Build Phases>Link Binary With Libraries and drag the libJavaScriptCore.a to the top of the list. The clean and build, it should work fine.
3: In Xcode go to File> New File> Objective-C class. Call it 'EJBindingShowCB' and make it a subclass of EJBindingBase.
Make sure to save the new class in your Source>Ejecta folder.
This will create 2 files in that folder.
EJBindingShowCB.h and EJBindingShowCB.m
4: Edit EJBindingShowCB.h to look like this:
#import "EJBindingBase.h" #import "Chartboost.h" @interface EJBindingShowCB : EJBindingBase { } @end
5: Edit EJBindingShowCB.m to look like this:
#import "EJBindingShowCB.h" #import "Chartboost.h" @implementation EJBindingShowCB EJ_BIND_FUNCTION( showChartboostInterstitial, ctx, argc, argv ) { NSString * location = JSValueToNSString( ctx, argv[0] ); [[Chartboost sharedChartboost] showInterstitial:location]; }
6: Now call the following init somewhere in your ImpactJS code (The Main Game init for example):
showAd = new Ejecta.ShowCB();
7: Then just call the following whenever you want to show an Ad:
showAd.showChartboostInterstitial(Named_location_s_string);
Note: In CB, a named location is just a way for you to have more control over where you show ads in your game. For example, you could create a named location called "MainMenu", then in your Chartboost publishing campaign you can specify how often you show Ads in the MainMenu.
That should be it.
Full Disclosure: I currently work at Chartboost
Extra Disclosure: I love ImpactJS :D
Here is the CB helpsite with all the info you need to get started using Chartboost:https://help.chartboost.com/