我正在尝试获取用户的对象ID。用户字符串为friendusername
。
打印objectid: []
override func viewWillAppear(animated: Bool) {
print(friendusername)
var query = PFUser.query()
let objId = query!.whereKey("username", equalTo: friendusername)
print(objId)
query!.getFirstObjectInBackgroundWithBlock{
(userobject: PFObject?, error: NSError?) -> Void in
if error == nil{
var objectid = userobject?.objectId
print("objectid: \(objectId)")
print(error)
}else{
print(error)
}
}
}