Parse/PFQueryTableView : 将额外文本附加到解析中的对象

Parse/PFQueryTableView : Append extra text to an object in parse

如何在解析中将文本或 space 附加到对象的文本之前或之后。

我想在一个对象中的任何文本前添加 #。

  cell.TextLabel.text = object?.objectForKey("Hashtag") as? String

当我尝试这样做时出现错误:

cell.TextLabel.text = "# " + object?.objectForKey("topic") as? String

无需解析,我可以简单地添加它而不会出现任何错误:

cell.TextLabel.text = " # " + test[indexpath.row]

问题是您要连接字符串?用一个字符串。 就这样做:

cell.TextLabel.text = "# " + (object?.objectForKey("topic") as! String)

或更好

cell.TextLabel.text = "# " + (object?.objectForKey("topic") as? String ?? "")