gpt4 book ai didi

ios - Chartboost SDK 快速集成

转载 作者:可可西里 更新时间:2023-11-01 00:53:32 24 4
gpt4 key购买 nike

我一直在尝试将 Objective C Chartboost SDK 集成到 Swift 项目中,方法是按照他们网站上的教程进行操作,并通过使用桥接头等尽我所知使其适应 swift。不幸的是,当我运行初始 AppDelegate 代码时,我得到了如以下屏幕截图所示的一些错误

图片链接:

https://imgur.com/wO5eyem

然后我尝试像在 Objective C 中那样在字符串之前放置 @ 符号,这也带来了大量错误,经过大量研究后我仍然没有真正找到解决这个问题的方法,但这些是错误当我尝试以下列方式添加 @ 符号时给出。

Chartboost.startWithAppId(appId:@"appID", appSignature:@"appSig", delegate: self)

图片链接:

https://imgur.com/HQqMYEj

我还尝试了以下操作,但遇到了另一个类似的错误:

    let kChartboostAppID: NSString = "123"
let kChartboostAppSignature: NSString = "123"
Chartboost.startWithAppId(appId:kChartboostAppID, appSignature:kChartboostAppSignature, delegate: self)

但这给了我以下错误(类似于第一个错误):

无法将表达式的类型“(appId: NSString, appSignature: NSString, delegate: AppDelegate)”转换为类型“(String!, appSignature: String!, delegate: ChartboostDelegate!) -> Void”

我将非常感谢任何帮助,因为我已经尝试解决这个问题很长时间了:)

最佳答案

这对我有用...

  1. 将框架放入支持文件

  2. 添加到桥接头

    #import <UIKit/UIKit.h>
    #import <Chartboost/Chartboost.h>
  3. 将 chartboost 委托(delegate)添加到 appdelegate.swift

    class AppDelegate: UIResponder, UIApplicationDelegate, ChartboostDelegate {
  4. 在 appldelegate didfinishlaunching 中

    let kChartboostAppID = "appid"
    let kChartboostAppSignature = "appsignature"
    Chartboost.startWithAppId(kChartboostAppID, appSignature: kChartboostAppSignature, delegate: self)
    Chartboost.setShouldRequestInterstitialsInFirstSession(false)
  5. 展示广告

    Chartboost.showInterstitial(CBLocationHomeScreen)
    Chartboost.showInterstitial("AnyCusotmTitleID")

关于ios - Chartboost SDK 快速集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27588814/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com