1

I've integrated Chartboost into my app and I am able to see ads, but I don't have a firm grasp of delegates and I am having trouble using the Chartboost provided code to cause actions to occur after an ad is viewed. My app delegate code is below (i replaced the actual appid and signature that I'm using):

class AppDelegate: UIResponder, UIApplicationDelegate, ChartboostDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
            application.isStatusBarHidden = true

       Chartboost.start(withAppId: "appID", appSignature: "appSignature", delegate: self)

       Chartboost.cacheRewardedVideo(CBLocationHomeScreen)
       Chartboost.cacheInterstitial(CBLocationHomeScreen)

        func didDisplayInterstitial(_ location: String!){print("didDisplayI")}
        func didCloseInterstitial(_ location: String!){print("didCloseI")}
        func didDismissInterstitial(_ location: String!){print("didDismissI")}

        return true
    }

Then in my ViewController I have the following:

class CharacterCreationViewController: UIViewController, ChartboostDelegate {

weak var delegate: ChartboostDelegate?

Override func viewDidLoad() {
        super.viewDidLoad()
        Chartboost.setDelegate(self)
    }

@IBAction func watchAd(_ sender: Any) {

        Chartboost.showInterstitial(CBLocationLevelStart)
        delegate?.didDismissInterstitial!(CBLocationLevelStart)
        delegate?.didCloseInterstitial!(CBLocationLevelStart)
        delegate?.didDisplayInterstitial!(CBLocationLevelStart)

           }

The watchAd function is a button, and when I press it the ad runs, but none of the actions in the appDelegate file run once the ad is completed/dismissed/closed.

I've searched StackOverflow and the Chartboost help sections and messaged Chartboost support but I'm struggling to find where I've gone wrong.

Dominick
  • 164
  • 2
  • 4
  • 13
  • did you find a fix for this? because i'm having the same trouble – Astrum May 20 '18 at 08:33
  • Hi Astrum, I was able to figure this out but then 6 days in Chartboost closed my account for no reason and refused to respond to my e-mail requests for clarification so I would like to recommend AdMob instead of Chartboost if you can. If you're really set on Chartboost I can post my fixed code here, let me know. – Dominick May 22 '18 at 03:33
  • It’s all good i’ve Moved to AdMob too it was way easier. Thanks for that – Astrum May 23 '18 at 04:12
  • The one thing I'm struggling with using AdMob is the new EU rules, are you using their tools to gather consent for that? – Dominick May 23 '18 at 04:37

0 Answers0