我正在尝试下载用户名并将其附加到列表中,以便最终可以在表格中显示。
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
var query = PFUser.query()
query?.findObjectsInBackgroundWithBlock({ (objects, error) -> Void in
if let users = objects {
self.usernames.removeAll(keepCapacity: true)
self.userids.removeAll(keepCapacity: true)
for object in users {
if let user = object as? PFUser {
self.usernames.append(user.username!)
self.userids.append(user.objectId!)
} else {
println(error)
}
}
}
println(self.usernames)
println(self.userids)
})
}
当我打印列表时没有任何反应,所以我只能断定我的应用程序没有检索到这些信息。有谁知道这是为什么?