Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

10 years 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:

#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/

10 years ago by richardelms

Edit:

EJBindingShowCB.m needs to look like this to work properly

#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];
    return NULL;
}

10 years ago by aquinn

Thanks! I'll give it a try.
Anyone else got Chartboost working OK with Ejecta?

9 years ago by MATRIXREAL

hi
i do exactly what you write
every thing is okay no warning no error on xcode

but that not work

maybe because :

1-i use ejecta and construct 2 and i call the init "showAd = new Ejecta.ShowCB();" in my index.js

2-i use an execute javascript action for this to call an ad "showAd.showChartboostInterstitial(Named_location_s_string);"

that must work because for example for tappx .... to call a ad i use same action execute javascript action with following "tappx.showbannerad(true, ",")"

but that not work for chartboost

is this my question is this a javascript call or not "showAd.showChartboostInterstitial(Named_location_s_string);"

thanks

9 years ago by Rungo73

Has anyone got this working with latest Chartboost sdk 5.x ?
Page 1 of 1
« first « previous next › last »