Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何使用swift按创建日期查询解析数据?_Ios_Iphone_Swift_Parse Platform_Ios8 - Fatal编程技术网

Ios 如何使用swift按创建日期查询解析数据?

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.

我希望能够按创建日期组织我从parse接收的数据,我该怎么做

我在线查看了解析文档,但没有找到任何说明如何按创建日期查询数据的内容。我也看到了堆栈溢出的答案,但它在objective-c中。请迅速回答

这是我现在用来接收数据的代码

  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按创建日期排序