chartboost.init() problems

Hi, guys! I have some issues with the chartboost plugin. While trying to initialize a chartboost session (on iOS device) by using chartboost.init I get an error: Invalid option ‘appSig’. I’ve double checked my chartboost application signature, there is no any errors in the string value that I use as parameter, it is totally correct.

Since _chartboost.init _results the error, there is no any activity related to the charboost plugin in my application, _chartboost.init _doesn’t call ad listener and so on. Do you have any ideas why do I have such error? Thank you in advance.

My code is similiar to the documentation:

local chartboost = require( "plugin.chartboost" ) local function adListener( event ) ... end chartboost.init( adListener, { appId="myAppID", appSig="myAppSignature" } )

can you post your build.settings?

Sure. Here it is. The platform the app was tested on is iOS 10.2.

settings = { orientation = { default = "portrait", supported = { "portrait", } }, iphone = { plist = { CFBundleDisplayName = "My App", CFBundleName = "My App", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-167.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-40@3x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png" }, UILaunchImages = { { --iPhone 4 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 480}" }, { --iPhone 5 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPad Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Portrait", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{768, 1024}" }, { --iPhone 6 Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{375, 667}" }, { --iPhone 6 Plus Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-736h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPad Pro Portrait ["UILaunchImageMinimumOSVersion"] = "9.0", ["UILaunchImageName"] = "Default-Portrait-1366", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{1024, 1366}" }, }, UIApplicationExitsOnSuspend = false, UIPrerenderedIcon = true, UIStatusBarHidden = true, MinimumOSVersion = "7.0", }, }, android = { usesPermissions = { "android.permission.INTERNET", }, usesFeatures = { { name="android.hardware.camera", required=false }, { name="android.hardware.location", required=false }, { name="android.hardware.location.gps", required=false }, }, allowAppsReadOnlyAccessToFiles = false, }, plugins = { ["plugin.flurry.analytics"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["plugin.chartboost"] = { publisherId = "com.coronalabs" }, }, }

Thanks.

I forgot to ask, which Corona build are you using?

As I see: 2016.2992. 

OK. 

You’ll need to use Corona SDK build 2016.3016 or later to get the latest Chartboost plugin.

Also I assume you have bought the Chartboost Pro plugin?

FYI. 

The Chartboost plugin that was part of Corona Ads is not available anymore.

Corona Ads has been shut down, as was announced in December 2016:

https://coronalabs.com/blog/2016/12/19/new-corona-professional-bundle-retiring-corona-ads/

Thank you very much. It has started to work… in some form:) I’ve changed the SDK, it is 2017.3060 now. So there is no error about appSig option anymore, adListener starts, it processes event.phase==“init” succesfully. But unfortunately the app can’t load any ad. event.phase==“loaded” has never occured (event.isError is true, event.response returns string “loadFailed”, but not the digital code of the error as the documentation says).

The code I use is taken from the documentation. I’m using the paid plugin for chartboost. Test mode is active. The code:

local chartboost = require( "plugin.chartboost" ) -- Chartboost listener function local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization chartboost.load( "interstitial" ) elseif ( event.phase == "loaded" ) then if ( event.type == "interstitial" ) then chartboost.show( "interstitial" ) end end end -- Initialize the Chartboost plugin chartboost.init( adListener, { appId="MYID", appSig="MYSIG" } )

The error code and error message is part of event.data. Event data is a JSON string so if you print it you’ll see the reason for why it’s failing to load. It looks like the docs are not fully up-to-date. I’ll make sure it’ll be fixed although it may take a few days…

If this is a new app, please remember you must create a Publishing Campaign in the Chartboost dashboard for each ad type you want to support, and assign your app to the campaign. Otherwise no ads will be served. This is the most common reason for new apps not loading ads.

Also, I’d recommend not to immediately show an ad after it’s been loaded.

It’s better that you issue your own chartboost.show() where it makes more sense in your code.

ingemar_cl you are simply the best!:slight_smile: Thank so much for help. Otherwise I would stuck with that problem forever:)

Now it works. Event.data helped a lot, thank you very much for your quote about JSON-string (as a hint for other users: use json.* library from Corona SDK to work with such type of data). Now I can see test ads and all work just fine.

Have a great day!

can you post your build.settings?

Sure. Here it is. The platform the app was tested on is iOS 10.2.

settings = { orientation = { default = "portrait", supported = { "portrait", } }, iphone = { plist = { CFBundleDisplayName = "My App", CFBundleName = "My App", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-167.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-40@3x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png" }, UILaunchImages = { { --iPhone 4 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 480}" }, { --iPhone 5 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPad Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Portrait", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{768, 1024}" }, { --iPhone 6 Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{375, 667}" }, { --iPhone 6 Plus Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-736h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPad Pro Portrait ["UILaunchImageMinimumOSVersion"] = "9.0", ["UILaunchImageName"] = "Default-Portrait-1366", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{1024, 1366}" }, }, UIApplicationExitsOnSuspend = false, UIPrerenderedIcon = true, UIStatusBarHidden = true, MinimumOSVersion = "7.0", }, }, android = { usesPermissions = { "android.permission.INTERNET", }, usesFeatures = { { name="android.hardware.camera", required=false }, { name="android.hardware.location", required=false }, { name="android.hardware.location.gps", required=false }, }, allowAppsReadOnlyAccessToFiles = false, }, plugins = { ["plugin.flurry.analytics"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["plugin.chartboost"] = { publisherId = "com.coronalabs" }, }, }

Thanks.

I forgot to ask, which Corona build are you using?

As I see: 2016.2992. 

OK. 

You’ll need to use Corona SDK build 2016.3016 or later to get the latest Chartboost plugin.

Also I assume you have bought the Chartboost Pro plugin?

FYI. 

The Chartboost plugin that was part of Corona Ads is not available anymore.

Corona Ads has been shut down, as was announced in December 2016:

https://coronalabs.com/blog/2016/12/19/new-corona-professional-bundle-retiring-corona-ads/

Thank you very much. It has started to work… in some form:) I’ve changed the SDK, it is 2017.3060 now. So there is no error about appSig option anymore, adListener starts, it processes event.phase==“init” succesfully. But unfortunately the app can’t load any ad. event.phase==“loaded” has never occured (event.isError is true, event.response returns string “loadFailed”, but not the digital code of the error as the documentation says).

The code I use is taken from the documentation. I’m using the paid plugin for chartboost. Test mode is active. The code:

local chartboost = require( "plugin.chartboost" ) -- Chartboost listener function local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization chartboost.load( "interstitial" ) elseif ( event.phase == "loaded" ) then if ( event.type == "interstitial" ) then chartboost.show( "interstitial" ) end end end -- Initialize the Chartboost plugin chartboost.init( adListener, { appId="MYID", appSig="MYSIG" } )

The error code and error message is part of event.data. Event data is a JSON string so if you print it you’ll see the reason for why it’s failing to load. It looks like the docs are not fully up-to-date. I’ll make sure it’ll be fixed although it may take a few days…

If this is a new app, please remember you must create a Publishing Campaign in the Chartboost dashboard for each ad type you want to support, and assign your app to the campaign. Otherwise no ads will be served. This is the most common reason for new apps not loading ads.

Also, I’d recommend not to immediately show an ad after it’s been loaded.

It’s better that you issue your own chartboost.show() where it makes more sense in your code.

ingemar_cl you are simply the best!:slight_smile: Thank so much for help. Otherwise I would stuck with that problem forever:)

Now it works. Event.data helped a lot, thank you very much for your quote about JSON-string (as a hint for other users: use json.* library from Corona SDK to work with such type of data). Now I can see test ads and all work just fine.

Have a great day!