我正在将chartboost集成到我的sprite kit游戏中,并成功地将桥接文件集成到我的swift代码中。现在在我的app委托中,我有以下内容:
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) {
}
startWithId行给出了一个错误,它无法使用这些参数(String,String,AppDelegate)调用此方法。这曾经在我的客观c代码上正常工作..任何人都知道如何解决这个问题?
答案 0 :(得分:0)
class AppDelegate: UIResponder, UIApplicationDelegate, ChartboostDelegate
修改(来自Lalit的评论)
在startWithAppId
中,委托设置为self
,因此您必须将类AppDelegate
设置为委托,使用以下命令完成:
ChartboostDelegate(protocol)