Could not find member 'Value'

32 views
Skip to first unread message

Justin Bane

unread,
Jul 30, 2015, 1:51:28 PM7/30/15
to Firebase Google Group
So this works everywhere I have used it before. I have wiped and remade my controller twice.

This code is throwing an error "Could not find member 'Value'" in XCode.

var identifierRef = ref.childByAppendingPath(identifier)

identifierRef.observeEventType(.Value, withBlock: { (snapshot) -> Void in


    self.cellLineLbl.text = snapshot.value.objectForKey("misidentified-cell-line")


})


It is referring to the .Value in the observeEventType call. Not a clue what to do here. This controller is being presented modally is the only difference AND yes I have my "let ref = ..." at the top of the class.

Any help or has anyone had this happen before? Nothing I do gets around it. I am completely stuck.

Justin Bane

unread,
Jul 30, 2015, 2:04:44 PM7/30/15
to Firebase Google Group, just...@gmail.com
Sorry btw this is iOS Swift.

Thomas Bouldin

unread,
Aug 5, 2015, 2:43:43 PM8/5/15
to Firebase Google Group, just...@gmail.com
Sorry for the late reply. I hope you've already found this out, but Swift sometimes has trouble inferring types when a function has many overloads and the compiler error it gives you isn't always obvious.

Try using an alternate or more explicit block syntax. I tend to either write:

query.observeEventType(.Value, withBlock: { (FDataSnapshot snapshot) -> Void in
  //...
})

or

query.observeEventType(.Value, withBlock: { snapshot in
  //...
})

Justin Bane

unread,
Aug 5, 2015, 2:54:59 PM8/5/15
to Thomas Bouldin, Firebase Google Group
Thomas, thanks for the reply... I did find that being more explicit in the block definition got the compiler error to go away.

Thanks!

---------------------------------------------------------------
Justin Bane
wk: 541-241-2263
cell: 916-712-2194
just...@gmail.com
---------------------------------------------------------------
www.justinbane.com
Reply all
Reply to author
Forward
0 new messages