【问题标题】:no such module 'Firebase' in Xcode (Swift)Xcode(Swift)中没有这样的模块'Firebase'
【发布时间】:2016-11-04 13:05:00
【问题描述】:

我一直在查找与此 Xcode 错误有类似/相同问题的每个网站,我已经尝试了所有方法,但没有任何效果。大多数人说清理和构建项目将使 Firebase 得到认可,但这并没有奏效。我尝试了一堆不同的框架搜索路径,但每个框架都在不同的文件夹中,而不是一个框架文件夹。这是我的 podfile:

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

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

 # Pods for Target

  target 'TargetTests' do
    inherit! :search_paths
    pod 'Firebase', '>= 2.5.0'
    # Pods for testing
 end

end

these are my project folders

我已经尝试让我的框架搜索路径 $(SRCROOT) 和所有变体都不起作用。我的问题似乎与我可以通过谷歌搜索找到的任何其他问题不同。我怀疑它是框架搜索路径,但我不知道该怎么做,我可能是错的。

任何帮助将不胜感激。

【问题讨论】:

  • 您是否尝试过在 target> 中嵌入带有库的二进制文件。我的意思是您添加了框架??
  • 您确定查看的是 .xcworkspace 文件而不是 .xcproj 文件吗?这为我解决了问题。
  • 另外,这很明显,但是...您确实运行了 'pod install' 对吗?
  • 我在 .xcworkspace 中,我已经运行了 pod install,到目前为止还没有运气:(

标签: ios xcode swift firebase firebase-realtime-database


【解决方案1】:

这对我有好处:

platform :ios, '10.0'
use_frameworks!

def shared_pods
   pod 'Firebase'
end

target 'TargetName' do
   shared_pods
end

target 'TargetNameDev' do
   shared_pods
end

【讨论】:

    【解决方案2】:
    # Uncomment this line to define a global platform for your project
    platform :ios, '9.0'
    
    # Comment this line if you're not using Swift and don't want to use dynamic frameworks
      use_frameworks!
    
      # Pods for Promposal
    
    target 'Promposal' do
    
        pod 'Firebase', '>= 2.5.0'
    
        # Pods for testing
     target 'PromposalTests' do
        inherit! :search_paths
        pod 'Firebase', '>= 2.5.0'
     end
    
    end
    

    您正确地编写了podfile,并且仅将Firebase 添加到test。试试这个podfile 并检查。

    【讨论】:

    • 这成功了!谢谢你。当我在终端中安装 pod 时,它告诉我“Promposal [Release] 目标覆盖了在Pods/Target Support Files/Pods-Promposal/Pods-Promposal.release.xcconfig'. This can lead to problems with the CocoaPods installation - Use the $(inherited)` 标志中定义的 FRAMEWORK_SEARCH_PATHS 构建设置,或者 - 从目标中删除构建设置。”我将我的框架搜索路径更改为 $(inherited) 并消除了错误。现在我遇到了一个新的但希望不那么困难的错误,“无法调用非函数类型'module'的值”
    • 这个新错误是由于我的代码行 "var myRootRef = Firebase(url:"my-url.firebaseio.com")" 其中 my-url 是一个真实的 url
    • 代替var myRootRef = Firebase(url:"my-url.firebaseio.com"),试试var rootRef = FIRDatabase.database().reference()
    • 再次感谢您!这行得通。我不知道您是否对此有答案,但是您知道现在哪里有使用 Firebase 的教程,因为它已经更新并且以前的语法不再有效?看来这次 Firebase 更新是全新的,并且许多在线教程都使用旧的、不再有效的语法,例如 var myRootRef = Firebase(url:"my-url.firebaseio.com")
    • 所有内容都在Docs 中。通过它应该可以帮助您更好地编码。
    猜你喜欢
    • 2016-07-11
    • 2022-10-22
    • 1970-01-01
    • 1970-01-01
    • 2020-10-23
    • 1970-01-01
    • 2016-10-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多