我發現了一個有趣的錯誤XCode中6個成員的:UICollectionView沒有一個名爲dequeueResuableCellWithReuseIdentifier
UICollectionView does not have a member named dequeueResuableCellWithReuseIdentifier
在第二行(「讓細胞...」)將出現在以下的錯誤功能:
override func collectionView(collectionView: UICollectionView?, cellForItemAtIndexPath indexPath: NSIndexPath?) -> UICollectionViewCell {
// Configure the cell
let cell:FightCollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as FightCollectionViewCell
let battle = self.lobbyData.objectAtIndex(indexPath!.row) as PFUser
PFCloud.callFunctionInBackground("getOnlineUsers", withParameters: [:], target: nil, selector: "block:")
func block(users: NSArray, error:NSError!){
if(error == nil){
let user:PFUser = (users as NSArray).lastObject as PFUser
let avatarObject = user["avatar"] as PFObject!
avatarObject.fetchInBackgroundWithBlock {
(object: PFObject!, error: NSError!) in
if error == nil {
let imageFile = object["image"] as PFFile
imageFile.getDataInBackgroundWithBlock {
(imageData: NSData!, error: NSError!) -> Void in
if error == nil {
let image = UIImage(data:imageData)
cell.avatarImageView.image = image
}
}
}
}
}
}
return cell
}
此代碼沒有在XCode 6測試版中拋出錯誤。爲什麼XCode現在對這行代碼有問題?我是iOS開發新手,所以任何幫助將不勝感激。
謝謝!