如何检查图像中是否存在解析?检查图像是否存在Parse.com
这是我的查询代码:
func queryFromParse(){
self.imageFiles.removeAll()
var query = PFQuery(className: "currentUploads")
query.orderByDescending("createdAt")
query.findObjectsInBackgroundWithBlock { (posts: [AnyObject]?, error: NSError?) -> Void in
if (error == nil){
// Success fetching objects
for post in posts!{
println(post)
self.imageFiles.append(post["imageFile"] as! PFFile)
self.imageText.append(post["imageText"] as! String)
}
self.collectionView.reloadData()
println(self.imageFiles.count)
}
else{
println(error)
}
}
}
如果图像无法上传来分析,它看起来像这样: Image Here
应用程序崩溃,如果不包含图像,因此如何我可以检查图像是否存在,并跳过它,如果它不包含图像?
您可以通过使用PFQuery来使用query.whereKeyExists(“keyName”)。 –