天道酬勤,学无止境

xcode error : Cannot call value of non-function type module Firebase

I try to use firebase from xcode and i have this error:

Cannot call value of non-function type module Firebase 

(i did not have problem with Firebase import)

I try to setup again firebase manually but i have the same error!!

Do i have to uninstall cocoapods?

I use xcode 7.3.1(7d1014) and my pod file look like this:

# Uncomment this line to define a global platform for your project
platform :ios, ‘9.3’

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

  # Pods for FIRST
      pod ‘Firebase’, ‘>=2.5.1’

  target 'FIRSTTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

anyone help??

评论

You need to install 'Firebase/database' using pod, as stated in this answer:

https://stackoverflow.com/a/37437790/2301570

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • Cannot call value of non-function type 'module<Firebase>'
    i have a strange error when i was using firebase from google. when i trying to init the Fire base setup the ref address for it using this code here let BASE_URL = "YOUR_FIREBASE_URL" var FIREBASE_REF = Firebase(url: BASE_URL) , it shows an error: Cannot call value of non-function type 'module<Firebase>' my pod file looks like this: # Uncomment this line to define a global platform for your project # platform :ios, '9.0' target 'Mission Board' do # Comment this line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! pod 'Firebase', '>=2.4.2' end Environment
  • 在 Xcode 中设置 Firebase 时出错(Error setting up Firebase in Xcode)
    问题 我尝试使用 Firebase 网站上的快速设置说明和手动替代说明来设置 Firebase 以在 Xcode 上工作。 当我使用 CocoaPods 并按照快速设置页面上的说明进行操作时,我能够导入 Firebase,但无法在类中引用 Firebase。 我收到错误:无法调用非函数类型“模块”xcode 的值 当我尝试手动设置它时,我无法导入或引用 Fire base 并且出现错误:没有这样的模块“Firebase” 回答1 将我的项目更新到新版本的 Firebase 时,我遇到了同样的问题。 在 Google I/O 上宣布了大量更改,因此需要进行大量更新。 听起来您可能正在使用旧版 Firebase 和新 SDK。 您应该使用 Firebase 3.0 做所有事情。 因此var rootRef = Firebase(url:"https://<YOUR-FIREBASE-APP>.firebaseio.com")现在将是var rootRef = FIRDatabase.database().reference() 。 请查看以下设置指南:https://firebase.google.com/docs/ios/setup#prerequisites(确保您没有查看旧文档!)。 如果您想将旧版 Firebase 的代码转换为 3.0,请查看升级教程:https:/
  • Error setting up Firebase in Xcode
    I have tried to set up Firebase to work on Xcode using both the quick setup instructions and the manual alternate instructions on Firebase website. When I used CocoaPods and followed the instructions on the quick setup page, I was able to import Firebase, but I was not able to reference Firebase inside the class. I got the error: Cannot call value of non-function type 'module' xcode When I tried to set it up manually, I was not able to import or reference Fire base and I got the error: No such module 'Firebase'
  • Cannot call value of non-function type 'Any?!' :- Firebase,Swift3
    This is my code before moving to Swift 3: ref.observeEventType(.ChildAdded, withBlock: { snapshot in let currentData = snapshot.value!.objectForKey("Dogs") if currentData != nil { let mylat = (currentData!["latitude"])! as! [String] let mylat2 = Double((mylat[0])) let mylon = (currentData!["longitude"])! as! [String] let mylon2 = Double((mylon[0])) let userid = (currentData!["User"])! as! [String] let userid2 = userid[0] let otherloc = CLLocation(latitude: mylat2!, longitude: mylon2!) self.distanceBetweenTwoLocations(self.currentLocation, destination: otherloc, userid: userid2) } }) This is my
  • 无法调用非函数类型“CIImage”的值?(Cannot call value of non-function type 'CIImage?')
    问题 这段代码确实编译得很好 let ciImage = CIImage(image:UIImage()) 但是当我将它移到UIImage的扩展中时 extension UIImage { func foo() { let ciImage = CIImage(image:UIImage()) // compile error } } 我收到以下编译错误 Cannot call value of non-function type 'CIImage?' 为什么? 使用 Xcode Playground 7.1.1 测试。 和 Swift 2.1 回答1 这是因为,一旦在 UIImage 内部,术语CIImage被视为 UIImage 的CIImage属性,由于隐式self作为消息接收者 - 换句话说,Swift 将您的CIImage变成self.CIImage并且从那里开始一切都在走下坡路。 您可以通过消除 Swift 使用模块命名空间的歧义来解决此问题: extension UIImage { func foo() { let ciImage = UIKit.CIImage(image:UIImage()) } } 编辑在 Swift 3 中,这个问题会消失,因为所有属性都将以小写字母开头。 该属性将命名为ciImage ,不会与 CIImage 类混淆。
  • 无法调用非函数类型“Any?!”的值 :- Firebase,Swift3(Cannot call value of non-function type 'Any?!' :- Firebase,Swift3)
    问题 这是我在转向 Swift 3之前的代码: ref.observeEventType(.ChildAdded, withBlock: { snapshot in let currentData = snapshot.value!.objectForKey("Dogs") if currentData != nil { let mylat = (currentData!["latitude"])! as! [String] let mylat2 = Double((mylat[0])) let mylon = (currentData!["longitude"])! as! [String] let mylon2 = Double((mylon[0])) let userid = (currentData!["User"])! as! [String] let userid2 = userid[0] let otherloc = CLLocation(latitude: mylat2!, longitude: mylon2!) self.distanceBetweenTwoLocations(self.currentLocation, destination: otherloc, userid: userid2) } }) 这是我迁移到 Swift 3后的代码: ref
  • ResponseSerializer 'cannot call value of non-function type 'NSHTTPURLResponse?'' with Swift 3
    I had been using the following code without issue until updating to Xcode 8 beta 6. It is similar to this example from the Alamofire repository. This morning I updated my Alamofire library to the latest swift3 branch, which is now compatible with beta 6. It shows the error: Cannot call value of non-function type 'HTTPURLResponse?' A similar question exists here, but it is not based on the current version of Swift and Alamofire. From what I understand, this error is because it thinks that I am trying to return the Request property response instead of the function response(responseSerializer: <T
  • ResponseSerializer'无法调用非函数类型'NSHTTPURLResponse?'的值与Swift 3(ResponseSerializer 'cannot call value of non-function type 'NSHTTPURLResponse?'' with Swift 3)
    问题 在更新到 Xcode 8 beta 6 之前,我一直在使用以下代码没有问题。它类似于来自 Alamofire 存储库的这个示例。 今天早上我将我的 Alamofire 库更新到最新的swift3分支,它现在与 beta 6 兼容。它显示错误: Cannot call value of non-function type 'HTTPURLResponse?' 这里存在一个类似的问题,但它不是基于 Swift 和 Alamofire 的当前版本。 据我了解,这个错误是因为它认为我试图返回Request属性response而不是函数response(responseSerializer: <T>, completionHandler: <(Response<T.SerializedObject, T.ErrorObject>) -> Void>)并且它认为这是因为我传递给函数的responseSerializer或completionHandler中存在类型错误。 如何调整此代码以使其与函数声明和编译器兼容? 我在 completionHandler 中添加了@escaping以纠正错误。 import Foundation import Alamofire import SwiftyJSON extension Alamofire.Request { public func
  • iOS - 无法调用非函数类型“NSProgress”的值(iOS - Cannot call value of non-function type 'NSProgress')
    问题 我正在尝试使用 Alamofire 下载文件,并取得了进展。 但是我在progress线上收到此错误。 Cannot call value of non-function type 'NSProgress' 有什么问题? 我见过的所有示例,即官方示例,都做完全相同的事情! Alamofire.download(.GET, nsurl!.absoluteString, destination: { (temporaryURL, response) in return filepath }) .progress { (bytesRead, totalBytesRead, totalBytesExpectedToRead) in // <------ ERROR HERE dispatch_async(dispatch_get_main_queue(), { self.progressBar?.progress = totalBytesRead / totalBytesExpectedToRead }) } .response { (request, response, _, error) in self.loadImageFromFile(filepath.absoluteString) } 编辑: 在@mvoelkl 的建议之后,我在进度函数中添加了括号。 但结果还是一样:
  • Flutter Web App, Firebase.auth not working. Tried to call a non-function, such as null. 'dart.global.firebase.auth'
    I am trying to implement a simple Flutter Web App, with Firebase Auth. I am getting the error NoSuchMethodError: tried to call a non-function, such as null: 'dart.global.firebase.auth'. I have looked at other posts, such as "NoSuchMethodError: tried to call a non-function, such as null: 'dart.global.firebase.auth'" when initializing auth() in flutter for web and Flutter web: tried to call a non-function, such as null: 'dart.global.firebase.storage. Both suggest the same solution: add firebase-auth.js to index.html. I already did it. This is how my index.html file looks like: <!DOCTYPE html>
  • Flutter错误记录
    1.Xcode12 打包报错 Dart snapshot generator failed with exit code 1 Building App.framework for arm64... Building AOT snapshot in release mode (ios-release)... 13.2s Built to build/aot/. Snapshotting (IOSArch.armv7) exited with non-zero exit code: 1 Snapshotting (IOSArch.arm64) exited with non-zero exit code: 0 cp: build/aot/App.framework: No such file or directory error: cannot parse the debug map for 'build/aot/App.framework/App': No such file or directory Failed to generate debug symbols (dSYM) file for build/aot/App.framework/App. Xcode12移除了Valid Architectures(有效架构),设置Excluded Architectures(无效架构
  • 无法调用非函数类型“字符串”的值(Cannot call value of non-function type 'String')
    问题 我正在尝试将 ILTItem 变量传递到我的 ILTViewController 中,当用户通过深层链接启动我的应用程序时,由 AppDelegate.swift 触发。 我有错误的代码: 无法调用非函数类型“字符串”的值 在我定义ilt的行上。 这是我目前拥有的代码: let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate var ilt = ILT(homeworkID: 1234, title: "History ILT", subject: "History", teacher: "Miss A Smith", teacherCode: "asmith", studentID: 12345, description: "Description....", due: 1450137600, status: "In Progress", hasAttachments: true) var newVC = ILTViewController() newVC.ILTitem = ilt appDelegate.window?.addSubview(newVC.view) 为什么会这样? 在我的 ILTViewController 类中,我有: class
  • “NoSuchMethodError: tried to call a non-function, such as null: 'dart.global.firebase.auth'” when initializing auth() in flutter for web
    I'm trying to implement sign-in function with Firebase Authentication in Flutter for Web app. I can already use Firestore to store/ extract data in the same app without signing-in. When executing the app, it shows the error "NoSuchMethodError: tried to call a non-function, such as null: 'dart.global.firebase.auth'" I think the error is caused by calling auth() method. Can you please advise how I should fix it? Or, is Firebase Authentication not supported Flutter for web yet?? Imported firebase.dart. https://firebase.google.com/docs/reference/js/firebase import 'package:firebase/firebase.dart'
  • 无法在 Swift 应用中导入 Firebase(Cannot import Firebase in Swift app)
    问题 在尝试学习 Firebase 时,我按照 Firebase 网站的 IOS 快速入门部分中的步骤进行操作。 我使用 Cocoapods 并完全按照文档中的步骤进行操作。 但是,“导入 Firebase”会导致编译器错误。 我在任何地方都看不到框架,但我确实看到了 Firebase 目标 C 文件.. 通过遵循下载 zip 文件并将其添加到项目的手动过程,我可以使其工作。 但是,我想了解我做错了什么。 回答1 您不应该需要使用桥接头。 Firebase SDK 使用 Swift 模块映射,因此您必须让 CocoaPods 知道。 使用这个 podfile: use_frameworks! # this allows you to use import Firebase pod 'Firebase', '>= 2.5.0' 然后您应该能够在任何 Swift 文件中使用import Firebase 。 有时从 CocoaPods 安装打开后,XCode 可能会混淆。 执行Cmd+K清理和Cmd+Shift+R重建。 如果仍然给你错误,然后重新启动 Xcode 并尝试清理并再次构建。 回答2 文档已过时。 我用过: import FirebaseCore 回答3 import FirebaseCore 和FirebaseApp.configure() 这些是 Swift 中新记录的
  • Flutter web: tried to call a non-function, such as null: 'dart.global.firebase.storage
    Im using Firebase plugin for web and managed to work with firestore and authentication. Now, Im trying to enable firebase storage but when i instanciate Storage gives me this error tried to call a non-function, such as null: 'dart.global.firebase.storage for firestore and authentication I use : import 'package:firebase/firebase.dart' as fb; import 'package:firebase/firestore.dart'; fb.Auth _firebaseAuth = fb.auth(); Firestore _firestore =fb.firestore(); for Storage : fb.Storage storage = fb.storage();
  • Cannot call value of non-function type 'CGFloat' with the alpha property
    I am debugging a dropdown menu I converted from Objective-C. In it, I have this function: func showMenu() { self.menu.hidden = false self.menu.translatesAutoresizingMaskIntoConstraints = true closedMenuShape.removeFromSuperlayer() if shouldDisplayDropShape { self.view.layer.addSublayer(openMenuShape) } // Set new origin of menu var menuFrame: CGRect = self.menu.frame menuFrame.origin.y = self.menubar.frame.size.height - self.offset() var containerAlpha: CGFloat = fadeAlpha if SYSTEM_VERSION_LESS_THAN("7.0") { UIView.beginAnimations(nil, context: nil) UIView.setAnimationCurve(.EaseInOut) self
  • 无法将Firebase导入Swift类(Cannot Import Firebase Into Swift Class)
    问题 我对Firebase和构建iOS应用程序是完全陌生的。 在Xcode 7中,我尝试将Firebase导入到我的Swift类中。 在一个快速文件中,我键入了“ import Firebase”。 我收到一个错误消息,说 “没有这样的模块'Firebase'” 任何帮助将不胜感激。 回答1 有两种安装Firebase的方法:手动安装和使用CocoaPods安装。 我建议使用CocoaPods。 在您的Podfile ,确保指定use_frameworks! : platform :ios, "9.0" use_frameworks! target 'MyProject' do pod 'Firebase' end 然后,在pod install并打开MyProject.xcworkspace ,您应该能够使用import Firebase 。 杰伊(Jay)编辑: 如果您的目标是OS X,则您的pod文件可能看起来像这样 platform :osx, '10.10' use_frameworks! target 'MyProject' do pod 'FirebaseOSX', '>= 2.4.2' end 回答2 对我来说是这样的: 该框架现在称为FirebaseAnalytics,而不是Firebase。 官方文档甚至有此错误。 因此,在使用CocoaPods
  • 无法使用 alpha 属性调用非函数类型“CGFloat”的值(Cannot call value of non-function type 'CGFloat' with the alpha property)
    问题 我正在调试从 Objective-C 转换而来的下拉菜单。 在里面,我有这个功能: func showMenu() { self.menu.hidden = false self.menu.translatesAutoresizingMaskIntoConstraints = true closedMenuShape.removeFromSuperlayer() if shouldDisplayDropShape { self.view.layer.addSublayer(openMenuShape) } // Set new origin of menu var menuFrame: CGRect = self.menu.frame menuFrame.origin.y = self.menubar.frame.size.height - self.offset() var containerAlpha: CGFloat = fadeAlpha if SYSTEM_VERSION_LESS_THAN("7.0") { UIView.beginAnimations(nil, context: nil) UIView.setAnimationCurve(.EaseInOut) self.menu.frame = menuFrame self.container.alpha
  • Cannot call value of non-function type 'URLSession' error with mockURLSession
    I'm trying to unit test URLSession delegates with mockData. This is the delegate function that is being tested: urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) This is the unit test so far: func test_urlSession(){ let mockSession = MockURLSession(mockResponse: MockURLSession().successHttpURLResponse(request: self.urlRequest!) as! HTTPURLResponse) //error here sut?.urlSession(mockSession, task: MockURLSessionDataTask, didCompleteWithError: Error) } Whenever I try to inject the mockURLSession as a parameter the error: Cannot call value of non-function
  • iOS - Cannot call value of non-function type 'NSProgress'
    I'm trying to download a file using Alamofire, with progress. But I get this error at the progress line. Cannot call value of non-function type 'NSProgress' What's the problem? All the examples I've seen, namely the official one, do the exact same thing! Alamofire.download(.GET, nsurl!.absoluteString, destination: { (temporaryURL, response) in return filepath }) .progress { (bytesRead, totalBytesRead, totalBytesExpectedToRead) in // <------ ERROR HERE dispatch_async(dispatch_get_main_queue(), { self.progressBar?.progress = totalBytesRead / totalBytesExpectedToRead }) } .response { (request