从解析数组中删除单个项目

时间:2015-12-26 10:23:20

标签: ios arrays swift parse-platform

我正在尝试从Parse数组中删除项目。我有什么想法吗?

func deletePhoto(sender:UIButton) {
    let i : Int = (sender.layer.valueForKey("index")) as! Int
    let image = facebookPics[i]
    PFUser.currentUser()?.removeObject(facebookPics[i], forKey: "images")
    PFUser.currentUser()?.saveInBackground()
    facebookPics.removeAtIndex(i)
    self.mainCollectionView!.reloadData()

}

当我在UIButton内按UICollectionViewCell时,会发生这种情况。它将它从我的阵列中删除,其余的发生得相当顺利。 Parse 有什么问题?

1 个答案:

答案 0 :(得分:0)

找到答案:

问题基本上是,我需要重新登录,因为我的PFUser.currentUser是零。

但代码很好。

相关问题