我正在尝试为我的应用设置关注/关注者系统。我已经设置了装饰并显示。我的问题是,即使我知道它应该是假的,它也总是显示为真。我尝试了各种 if 语句,但似乎无法使用正确的变量或常量来运行检查,以便数组返回 true 或 false。数组 isFollowing[false] 以这种方式初始化。
相关代码
self.backendless.persistenceService.of(BackendlessUser.ofClass()).find( query, response: { ( objectId : BackendlessCollection!) -> () in
let currentPage = objectId.getCurrentPage()
for objects in currentPage as! [BackendlessUser] {
if (objects.objectId != self.backendless.userService.currentUser.objectId) {
self.userids.append(objects.objectId)
self.backendless.persistenceService.of(objects.ofClass()).find( query, response: { objects -> () in
if let objects = objects {
self.isFollowing.append(true)
} else {
self.isFollowing.append(false)
}
if self.isFollowing.count == self.usernames.count{
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.tableView.reloadData()
})
}
}, error: { ( fault : Fault!) -> () in
print("Server reported an error: \(fault)")
}
)
}
}
})