gpt4 book ai didi

ios - @lvalue $T 5' is not identical to ' Swift 中的 AnyObject

转载 作者:行者123 更新时间:2023-11-28 11:20:59 25 4
gpt4 key购买 nike

我有一个自定义的 TableViewCell,它有一个标签和一个按钮。我有一个 Int 数组 groupVote,它包含将填充 UITableView 中的标签 voteScoreLabel 的值。当点击按钮 upVoteButtonPressed 时,单元格的相应值会使用标签进行更新。但是在下面的代码中有一个错误(我已经把特定的行放在下面的代码中)显示:@lvalue $T5' is not identical to 'AnyObject!, when I want to update the value in Parse.这是什么意思,我该如何解决?

@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

}
}

最佳答案

您需要将 objects 转换为 PFObject 数组。

for object in objects as [PFObject] {
var textNumb = groupVote[self.voteScoreLabel.tag] as Int
object["vote"] = textNumb
}

关于ios - @lvalue $T 5' is not identical to ' Swift 中的 AnyObject,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28181160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com