Ios 比较PFObject和AnyObject-Parse.com+;网间网操作系统
我正在使用Swift和Parse.com 我有一个Ios 比较PFObject和AnyObject-Parse.com+;网间网操作系统,ios,swift,parse-platform,pfobject,Ios,Swift,Parse Platform,Pfobject,我正在使用Swift和Parse.com 我有一个PFQueryTableViewController填充了“posts”单元格。要仅在当前登录用户创建的帖子上显示选项按钮,我想检查帖子的“fromUser”属性(指向_user表的指针)是否与当前用户相同 但下面的代码不起作用…出现错误“无法将PFObject与AnyObject进行比较” 如何执行此逻辑?请尝试使用以下代码 var fromUser = post["fromUser"] as PFUser var curren
PFQueryTableViewController
填充了“posts”单元格。要仅在当前登录用户创建的帖子上显示选项按钮,我想检查帖子的“fromUser”属性(指向_user表的指针)是否与当前用户相同
但下面的代码不起作用…出现错误“无法将PFObject与AnyObject进行比较”
如何执行此逻辑?请尝试使用以下代码
var fromUser = post["fromUser"] as PFUser
var currentUser = PFUser.currentUser() as PFUser
// Show options button if post by user
if fromUser == currentUser {
self.optionsButton.hidden = false
}
请尝试以下代码
var fromUser = post["fromUser"] as PFUser
var currentUser = PFUser.currentUser() as PFUser
// Show options button if post by user
if fromUser == currentUser {
self.optionsButton.hidden = false
}
请尝试以下代码
var fromUser = post["fromUser"] as PFUser
var currentUser = PFUser.currentUser() as PFUser
// Show options button if post by user
if fromUser == currentUser {
self.optionsButton.hidden = false
}
请尝试以下代码
var fromUser = post["fromUser"] as PFUser
var currentUser = PFUser.currentUser() as PFUser
// Show options button if post by user
if fromUser == currentUser {
self.optionsButton.hidden = false
}
与
objectId
进行比较,objectId是用户的唯一Id
// Show options button if post by user
if post["fromUser"]["objectId"] == PFUser.currentUser().objectId() {
self.optionsButton.hidden = false
}
与
objectId
进行比较,objectId是用户的唯一Id
// Show options button if post by user
if post["fromUser"]["objectId"] == PFUser.currentUser().objectId() {
self.optionsButton.hidden = false
}
与
objectId
进行比较,objectId是用户的唯一Id
// Show options button if post by user
if post["fromUser"]["objectId"] == PFUser.currentUser().objectId() {
self.optionsButton.hidden = false
}
与
objectId
进行比较,objectId是用户的唯一Id
// Show options button if post by user
if post["fromUser"]["objectId"] == PFUser.currentUser().objectId() {
self.optionsButton.hidden = false
}
也可以只使用post[“fromUser”]。objectId()也可以只使用post[“fromUser”]。objectId()也可以只使用post[“fromUser”]。objectId()也可以只使用post[“fromUser”]。objectId()