【问题标题】:Cannot import ObjectMapper in Swift无法在 Swift 中导入 ObjectMapper
【发布时间】:2015-12-17 13:47:55
【问题描述】:

我需要将 JSON 反序列化为对象,我认为使用 ObjectMapper 会很棒。

很遗憾,无法导入对象映射器。我收到消息:

No such module 'ObjectMapper'

这是我的 podfile

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!



target 'OTTSwift' do
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Alamofire', '~> 3.0'
use_frameworks!
pod "EVReflection", '~> 2.6'
use_frameworks!
pod 'ObjectMapper', '~> 1.0'            
end

我什至尝试了 Git 导入,但它不起作用

【问题讨论】:

    标签: ios json swift alamofire json-deserialization


    【解决方案1】:

    我使用了它,XCode 在导入语句中向我显示了同样的错误,但如果你构建你的项目,它会构建得很好。 XCode 似乎需要一些时间来缓存新的更改,因为在下次导入时它不会显示任何错误。

    【讨论】:

    • 是的,完全正确。您需要构建您的项目,以便 Xcode 能够将新添加的框架链接到您的项目。
    • 没错。 XCode 需要时间来缓存任何新更改,遗憾的是不仅限于框架 :(
    • 我认为这种类型的问题会在 Swift 之后消失 :D :D
    • 我遇到了同样的问题,但构建并没有解决它。所以我必须手动添加嵌入式二进制文件
    • @UmairAfzal 你使用的是正确格式的 podfile 吗?
    【解决方案2】:

    当我删除项目的派生数据时,我总是遇到这个问题,我通过使用 pod update 更新依赖关系、清理项目并重新启动 Xcode 来修复它。

    【讨论】:

      猜你喜欢
      • 2017-02-27
      • 1970-01-01
      • 2016-03-31
      • 2014-07-26
      • 2016-11-21
      • 1970-01-01
      • 2018-05-09
      • 2016-03-16
      • 2020-04-11
      相关资源
      最近更新 更多