我根据Chartboost文档完成了所有步骤,将iOS SDK集成到我的应用程序中。但是在调用Chartboost的最后阶段,我遇到了编译错误:
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Begin a user session. Must not be dependent on user actions or any prior network requests.
// Must be called every time your app becomes active.
[Chartboost startWithAppId:@"some_id" appSignature:@"some_signature" delegate:self];
// Show an ad at location "CBLocationHomeScreen"
[[Chartboost sharedChartboost] showInterstitial:CBLocationHomeScreen];
在调用startWithAppId
方法时,我收到以下错误:
......../proj.ios_mac/ios/AppController.mm:101:126: Cannot initialize a parameter of type 'id<ChartboostDelegate>' with an lvalue of type 'AppController *'
答案 0 :(得分:0)
相反,
尝试使用此代码
Chartboost *cb = [Chartboost sharedChartboost];
cb.appId = @"some_id";
cb.appSignature = @"some_sig";
[cb startSession];
[cb showInterstitial];
答案 1 :(得分:0)
以下是可能遇到此主题的任何人的更新答案。经测试,适用于Chartboost 版本5.1.3
的2015年2月16日在appController.mm文件中添加以下导入:
#import <Chartboost/Chartboost.h>
#import <Chartboost/CBNewsfeed.h>
#import <CommonCrypto/CommonDigest.h>
#import <AdSupport/AdSupport.h>
接下来添加以下界面:
@interface AppController () <ChartboostDelegate>
@end
最后在你的applicationDidBecomeActive方法中添加:
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[Chartboost startWithAppId:@"appID" appSignature:@"appSIG" delegate:self];
[Chartboost showInterstitial:CBLocationHomeScreen];
//[Chartboost showInterstitial:@"CBLocationHomeScreen"]; //older way
}