本文介绍了从背景获取对象的奇怪事情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有疑问
private var query = PFQuery(className: "Ideas")
query.orderByDescending("createdAt")
query.findObjectsInBackgroundWithBlock { (data: [AnyObject]?, error) -> Void in
var objects = data as! [PFObject]
for tmp in objects {
self.ideas.insert(CIdea(parseObject: tmp), atIndex: 0)
}
}
我尝试从后台获取PFObject
数组,从其实例获取CIdea
并插入CIdea
数组,但是遇到了在
I try to get array of PFObject
from background, instance from it CIdea
and insert in CIdea
array, but got issue that found nil
in
var objects = data as! [PFObject]
推荐答案
if let objects = Object as? [PFObject]{
for tmp in objects {
self.ideas.insert(CIdea(parseObject: tmp), atIndex: 0)
}
}
这篇关于从背景获取对象的奇怪事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!