0
votes

I have a class with a key, "elementFileArray", with pointers to objects in another class. It may happen that one of these objects is deleted and the pointer remains there. I notice that the pointer just becomes "null" when I read the array. So:

self.collectionElementArray = (collectionElement?["elementFileArray"] as? [AnyObject])!

has "PFObject, PFObject, ... , null , ... , PFObject". I am trying ideally to delete that null from the array on the server. However it doesn't seem possible because I have no object Id. In the worst scenario I could delete it in this local array, but I don't know how.

1

1 Answers

1
votes

To filter out nil:

self.collectionElementArray.filter() { $0 != nil }