Ios 如何使用swift按创建日期查询解析数据?
我希望能够按创建日期组织我从parse接收的数据,我该怎么做 我在线查看了解析文档,但没有找到任何说明如何按创建日期查询数据的内容。我也看到了堆栈溢出的答案,但它在objective-c中。请迅速回答 这是我现在用来接收数据的代码Ios 如何使用swift按创建日期查询解析数据?,ios,iphone,swift,parse-platform,ios8,Ios,Iphone,Swift,Parse Platform,Ios8,我希望能够按创建日期组织我从parse接收的数据,我该怎么做 我在线查看了解析文档,但没有找到任何说明如何按创建日期查询数据的内容。我也看到了堆栈溢出的答案,但它在objective-c中。请迅速回答 这是我现在用来接收数据的代码 var query = PFQuery(className:"Class Name") //this is what i tried.. query.orderByDescending("createdAt") // query.
var query = PFQuery(className:"Class Name")
//this is what i tried..
query.orderByDescending("createdAt")
//
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]?, error: NSError?) -> Void in
if error == nil {
// The find succeeded.
// Do something with the found objects
if let objects = objects as? [PFObject] {
for object in objects {
self.NameArray.insert(object.valueForKey("Name")! as! String, atIndex: 0)
self.TextArray.insert(object.valueForKey("Text")! as! String, atIndex: 0)
}
}
} else {
// Log details of the failure
self.alert("Error: \(error!.localizedDescription)", Message: "Make sure you have a secure internet connection")
}
dispatch_async(dispatch_get_main_queue()) {
println("Finished importing")
self.collectionView.reloadData()
}
}
这个代码有什么问题?似乎已按照query.orderByDegeneratingCreatedat按创建日期排序