【发布时间】:2015-01-27 22:22:24
【问题描述】:
我有一个自定义的 TableViewCell,它有一个标签和一个按钮。我有一个 Int 数组 groupVote,它包含将填充 UITableView 中的标签 voteScoreLabel 的值。当点击按钮 upVoteButtonPressed 时,单元格的对应值会使用标签更新。但是在下面的代码中有一个错误(我在下面的代码中放入了特定的行),当我想更新 Parse 中的值时,它显示:@lvalue $T5' is not same to 'AnyObject!这是什么意思,我该如何解决?
@IBAction func upVoteButtonPressed(sender: AnyObject) {
println(groupVote[voteScoreLabel.tag])
groupVote[voteScoreLabel.tag]=groupVote[voteScoreLabel.tag]+1
var messageDisplayTwo = PFQuery(className:currentScreen)
messageDisplayTwo.whereKey("identifier", equalTo:voteScoreLabel.tag )
messageDisplayTwo.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]!, error: NSError!) -> Void in
if error == nil{
for object in objects {
var textNumb=groupVote[self.voteScoreLabel.tag] as Int
object["vote"]=textNumb //Error Right Here: @lvalue $T5' is not identical to 'AnyObject!
}
} else {
// Log details of the failure
}
}
【问题讨论】:
-
试试
for object in objects as [NSDictionary] {。 -
@vacawama 我刚试了一下,得到了错误“无法分配给这个表达式的结果”
标签: ios arrays swift parse-platform