4

I am integrating chartboost into my sprite kit game and have successfully integrated bridging files into my swift code. Now in my app delegate I have the following:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.


    let kChartboostAppID = "5554c8680d60255c6a0f4af4"
    let kChartboostAppSignature = "1d0e271cd054c9a63473d2f1212ca33a2922a19f"


    Chartboost.startWithAppId(kChartboostAppID, appSignature: kChartboostAppSignature, delegate: self)
    Chartboost.cacheMoreApps(CBLocationHomeScreen)
    return true
}

class func showChartboostAds()
{
    Chartboost.showInterstitial(CBLocationHomeScreen);
}
func didFailToLoadInterstitial(location: String!, withError error: CBLoadError) {

}

the startWithId line gives me an error that it cant invoke this method with these arguments ( String, String, AppDelegate). This used to work fine on my objective c code.. Anyone knows how to fix this?

TruniTr
  • 366
  • 3
  • 14
  • Has this been resolved? I can not seem to find an answer to this.. I get the following error: "Cannot convert value of type 'AppDelegate' to expected argument type 'ChartboostDelegate!'". Any help would be appreciated! – Kevin Horvath Sep 26 '15 at 19:40

1 Answers1

0
class AppDelegate: UIResponder, UIApplicationDelegate, ChartboostDelegate

Edit (from Lalit's comment below)

In startWithAppId the delegate is set to self, so you have to set the class AppDelegate as the delegate, which is done using:

ChartboostDelegate(protocol)
Glen Selle
  • 3,966
  • 4
  • 37
  • 59
  • 4
    This may answer the OP's question, but without any explanation, it's rather difficult to see how this would address the OP's question. Could you please add some info to make it clear how this resolves the issue? – Glen Selle Nov 22 '15 at 01:16
  • I had the same error regarding the delegate. I don't really know the proper words, but in startWithAppId the delegate is set to self, so you have to set the class AppDelegate as the delegate, which is done using ChartboostDelegate(protocol). – Lalit Prabhu Nov 22 '15 at 06:56
  • Thanks Lalit, in the future, just edit your answer and add the relevant information. I've gone ahead and added what I can. – Glen Selle Nov 22 '15 at 19:59