解析查询未按降序加载
Parse query not loading in descending order
出于某种原因,当我使用 Parse 将图像添加到 tableView 时,它可以很好地从 Parse 中提取文件,但没有按降序加载...不确定为什么?
感谢您的帮助!
class HomePageViewController: UIViewController, UITableViewDelegate {
@IBOutlet var homePageTableView: UITableView!
var albumImageFiles = [PFFile]()
var imageText = [String]()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
var query = PFQuery(className: "Posts")
query.orderByDescending("createdAT")
query.findObjectsInBackgroundWithBlock { (posts:[AnyObject]?, error: NSError?) -> Void in
if error == nil {
//success fetching objects
for post in posts! {
self.albumImageFiles.append(post["imageFile"] as! PFFile)
self.imageText.append(post["albumText"] as! String)
}
/*reload the table*/
self.homePageTableView.reloadData()
} else {
println(error)
}
}
}
query.orderByDescending("createdAT")
应该是
query.orderByDescending("createdAt")
出于某种原因,当我使用 Parse 将图像添加到 tableView 时,它可以很好地从 Parse 中提取文件,但没有按降序加载...不确定为什么?
感谢您的帮助!
class HomePageViewController: UIViewController, UITableViewDelegate {
@IBOutlet var homePageTableView: UITableView!
var albumImageFiles = [PFFile]()
var imageText = [String]()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
var query = PFQuery(className: "Posts")
query.orderByDescending("createdAT")
query.findObjectsInBackgroundWithBlock { (posts:[AnyObject]?, error: NSError?) -> Void in
if error == nil {
//success fetching objects
for post in posts! {
self.albumImageFiles.append(post["imageFile"] as! PFFile)
self.imageText.append(post["albumText"] as! String)
}
/*reload the table*/
self.homePageTableView.reloadData()
} else {
println(error)
}
}
}
query.orderByDescending("createdAT")
应该是
query.orderByDescending("createdAt")