swift 解析查询跳过空列

swift parse query skip null column

我正在执行 PFQuery 以获取列中的上传文件。如何获取该文件,如果该列为空,则没有文件执行其他操作?

如果该列为空,我将收到错误消息,查询将无法正常进行。

fatal error: unexpectedly found nil while unwrapping on Optional value

query.findObjectsInBackgroundWithBlock {
            (objects, error) -> Void in

            if error == nil
            {
                for object in objects! {
                    self.files.append(object.objectForKey("file") as! PFFile)     
                }

我想获取该文件,但如果该列为空,请执行其他操作?我该怎么做?

使用 if let file = ... as 的可选解包? PFFile {

}否则{

}