gpt4 book ai didi

ios - 尝试在 Swift 应用程序中导入 MoPub 库时出错(错误 : use of undeclared type)

转载 作者:搜寻专家 更新时间:2023-10-31 23:10:04 27 4
gpt4 key购买 nike

我正在尝试将 Mopub 库导入到新的 Swift 项目中。按照以下步骤操作:

  1. 创建新的 Swift 项目 + pod init
  2. 添加 pod pod 'mopub-ios-sdk
  3. pod install
  4. 打开项目(文件.xcworkspace)
  5. 创建一个虚拟的 ObjectiveC 文件以提示添加桥接 header
  6. MyProject-Bridging-Header.h文件添加行 #import <MoPub/MoPub-Bridging-Header.h>

此时项目已编译,但如果我尝试使用框架的类,XCode 会提示 error: use of undeclared type MPInterstitialAdController

哪里出错了?

注意:如果我创建的 App 项目是 ObjectiveC,则使用导入行到 #import <mopub-ios-sdk/MoPub-Bridging-Header.h>在第 6 步中足以使框架可以从 swift 代码访问。但我需要我的项目基于 Swift。

谢谢

最佳答案

设置桥接 header 后,我缺少导入语句:

import MoPub

:P

关于ios - 尝试在 Swift 应用程序中导入 MoPub 库时出错(错误 : use of undeclared type),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43376779/

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