【问题标题】:How to integrate Chartboost SDK in Swift SpriteKit?如何在 Swift SpriteKit 中集成 Chartboost SDK?
【发布时间】:2023-03-08 13:00:01
【问题描述】:

我刚刚找到 Chartboost,我现在正在尝试集成 SDK,但出于某种原因,在本教程的第 3 步:https://answers.chartboost.com/hc/en-us/articles/205853276-Download-Integrate-the-Chartboost-SDK-for-iOS-Swift 我收到一条错误消息:使用未解析的标识符“Chartboost”。我想我的头文件有问题,因为我认为那是我声明 Chartboost 的地方(步骤 2)。但也许它只是在错误的地方,因为他们没有说我必须把代码放在哪里,所以我只是把它放在 AppDelegate.swift 中,因为这是我知道的唯一一个具有 didFinishLaunchingWithOptions 函数的文件。那么我该如何解决这个问题呢?

头文件:

#ifndef Header_h
#define Header_h
#import <UIKit/UIKit.h>
#import <Chartboost/Chartboost.h>
#import <CommonCrypto/CommonDigest.h>
#import <AdSupport/AdSupport.h>

#endif /* Header_h */

AppDelegate:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Initialize the Chartboost library
        Chartboost.startWithAppId("AppId", appSignature: "AppSignature", delegate: nil)

    }

【问题讨论】:

  • 用相关代码更新您的问题并显示您在哪里得到错误。
  • 好吧,我现在改了
  • 那是哪个头文件?是否导入到 AppDelegate.swift 中?
  • 头文件是 Header.h,不,我没有将它导入 AppDelegate.swift 我该怎么做?抱歉,我的编程还不太好。

标签: ios swift chartboost


【解决方案1】:

我遇到了同样的问题,这就是我解决它的方法。

在 Swift Compiler - Code Generation 下的 Build Settings 中检查是否将 Objective-C Bridging Header 位置设置为正确的路径 (AppName/headername.h)

同样在 Build Settings - Packaging 下,将 Defines Module 设置为 Yes。

CMD + B,现在您可以继续第 3 步,而不会遇到未解决的标识符问题。

这应该会修复未解析的标识符。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-20
    • 1970-01-01
    相关资源
    最近更新 更多