即使"对象"执行进入for循环也是如此。是空的。我疯了吗?
query?.findObjectsInBackgroundWithBlock({ (objects:[PFObject]?, error:NSError?) -> Void in
if error == nil {
for object:PFObject? in objects! {
//Do something
}
} else {
NSLog("something's wrong")
}
})
答案 0 :(得分:0)
应该是
for object:PFObject in objects! //instead of "PFObject?"
一定是因为PFObject?可以从值为nil的空“对象”数组中获取并且它进入那里。它也变成了无限循环。试过PFObject!它仍然会进入那里......