【问题标题】:Chartboost and swift integrationChartboost 和快速集成
【发布时间】:2015-05-14 15:32:30
【问题描述】:

好的,这是我第一次尝试集成chartboost和swift,所以我会从头开始,也许我错过了一些东西。首先,我将 chartboost 框架导入到我的项目中,然后手动创建了 .h 文件,我将其命名为 BridgingHeader.h 我添加了所需的导入语句,因此该文件现在看起来像这样:

#ifndef appname_BridgingHeader_h
#define appname_BridgingHeader_h

#import <Chartboost/Chartboost.h>
#import <Chartboost/CBNewsfeed.h>
#import <CommonCrypto/CommonDigest.h>
#import <AdSupport/AdSupport.h>
#import <UIKit/UIKit.h>



#endif

我尝试构建,一切正常,但我注意到它实际上并没有导入此文件。因此,我进入了我的项目构建设置,位于 Swift Compiler - Code Generation 并找到了 Objective-C Bridging Header 并将其命名为 appname/BridgingHeader.h 。现在我确定它确实找到了该文件并尝试导入 chartboost 文件,因为我收到了 56 个错误,其中所有错误都在 chartboost 文件中。错误例如“此处不允许函数定义”或“预期类型”。最后一个错误说它无法导入桥接头。任何人都知道或有任何想法如何使这项工作?

谢谢

【问题讨论】:

    标签: ios objective-c xcode swift chartboost


    【解决方案1】:

    好的,我的问题。

    1) UIKit 的导入操作如下:

    #import <UIKit/UIKit.h>
    #ifndef appname_BridgingHeader_h
    #define appname_BridgingHeader_h
    
    #import <Chartboost/Chartboost.h>
    #import <Chartboost/CBNewsfeed.h>
    #import <CommonCrypto/CommonDigest.h>
    #import <AdSupport/AdSupport.h>
    
    
    
    #endif
    

    2) 对于路径,我应该只是转到桥接文件,在文件检查器中复制完整路径并将其粘贴到 Swift 编译器 - 代码生成中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-20
      • 1970-01-01
      • 1970-01-01
      • 2018-10-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多