Realm Swift 2.2.0:没有这样的模块" RealmSwift"在Xcode 8中

时间:2017-01-14 20:01:51

标签: realm

我尝试使用cocoapods使用RealmSwift,但我得到No Such Module" RealmSwift"错误。

pod安装成功并安装了Realm 2.2.0

我已经尝试过清理构建和构建文件夹以及派生数据 我还创建了一个虚拟项目并进行了全新安装,但它仍然无法正常工作。 当我只是尝试导入RealSwift和构建时,构建成功但在此之后,错误又回来了。

这是我的Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'RealmDummyProject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!

# Pods for RealmDummyProject
 pod 'RealmSwift'

 post_install do |installer|
  installer.pods_project.targets.each do |target|
   target.build_configurations.each do |config|
     config.build_settings['SWIFT_VERSION'] = '3.0' # or '3.0'
   end
  end
 end

end

我正在使用Xcode版本8.1(8B62)和Swift 3.0 谢谢!

2 个答案:

答案 0 :(得分:1)

使用CocoaPods而不是.xcworkspace生成的.xcodeproj文件来处理您的项目。而且,我相信你的PodFile应该是这样的:

来自境界Installation

  

如果使用Xcode 8,请将以下内容粘贴到Podfile的bottom ...

target 'RealmDummyProject' do
  use_frameworks!

  # Pods for RealmDummyProject
  pod 'RealmSwift'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

此外,这可能对您有所帮助: RealmSwift installation on Xcode

答案 1 :(得分:0)

刚遇到类似的问题。

打开.xcworkspace文件后,您应立即“编译项目”。

因为在你编译整个工作区之前,XCode第一次使用特定的Pod看起来好像不知道它。