[英]Error when running Firebase in Swift
I am playing around with Firebase and I am trying to print the value of an item in Swift. 我正在玩Firebase,并尝试在Swift中打印项目的值。 This is the only code in the whole application, so nothing really complicated is going on.
这是整个应用程序中唯一的代码,因此没有发生任何真正复杂的事情。
var myRootRef = Firebase(url:"https://jotty.firebaseio.com/")
override func viewDidLoad() {
super.viewDidLoad()
myRootRef.observeEventType(.Value, withBlock: {
snapshot in
println(snapshot.value)
})
}
When I run this I get an error: 当我运行它时,我得到一个错误:
2015-07-15 12:15:03.492 Jotty[32431:733653] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FRepo youForgotToSetMinusObjCInTheOtherLinkerFlagsInYourXCodeProject]: unrecognized selector sent to instance 0x7b28b7a0'
Would anyone know how to fix this? 有人知道如何解决这个问题吗? I have been trying to fix this all day but I have no idea what is wrong with the application.
我整天都在尝试解决此问题,但我不知道该应用程序有什么问题。
In "Build Settings" under "Other Linker Flags" use the "-ObjC" flag. 在“其他链接器标志”下的“构建设置”中,使用“ -ObjC”标志。
I recommend using CocoaPods instead of a manual setup . 我建议使用CocoaPods而不是手动设置 。
See the Firebase docs for a manual setup . 有关手动设置,请参阅Firebase文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.