没有这样的模块RealmSwift

内存

这不是重复的问题。我已经使用领域很长时间了。最近,我收到“没有这样的模块RealmSwift”的错误。但这仅在发布目标方案中发生,而在构建目标方案中没有发生。为什么它不能仅在发行版中起作用,是否有任何特殊原因?我在很多地方都看到了这个问题,但是这些解决方案都没有对我有用。

我的podfile看起来像这样:

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

#use_modular_headers!

inhibit_all_warnings!

def shared_pods

  pod 'RealmSwift'

end


target ‘************’ do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks

  use_frameworks!

  # Pods for ************

  shared_pods

  target '************Tests' do
    inherit! :search_paths
    # Pods for testing

  end

end

target '************UITests' do
  inherit! :search_paths
  # Pods for testing

#  shared_pods
end
周杰伦

因为我重复了您的问题,所以这比直接回答更像是一个故障排除步骤。

您已经使用Realm一段时间了,所以您知道这一点,但对于将来的读者,请确保您使用RealmSwift的任何文件都包含

import RealmSwift

我刚刚在一个新项目上尝试了您的podfile,并且也出现了奇怪的行为。我用以下5行替换了您的podfile,它可以正常工作。

project 'Realm Test.xcodeproj'
target 'Realm Test' do
  use_frameworks!
  platform :osx, '10.13'
  pod 'RealmSwift'
end

那是一个macOS项目,但与iOS项目同样出色。在那个项目上,我没有评论#platform:ios,'12 .0'

我认为这是问题

inherit! :search_paths

这样可以让目标知道搜索路径,但不将其链接。我建议将其更改为

inherit! :complete

这似乎在我的项目中工作。

哦-为了完整起见,我也遇到了这个问题,解决方法是

将RealmSwift.framework的父路径(即包含目录)添加到框架搜索路径。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章