2

I have my class name and friendName.

I dont have the objectId

What is the code to delete it in Parse from SWIFT?

In ObjC, it is something like:

PFObject *object = [PFObject objectWithoutDataWithClassName:@"invFriend"
                                               objectId:@"abcd"];
[object deleteEventually];

How can i do that from swift without objectId?

1 Answer 1

6

Here is the Swift equivalent code. Note that you must supply a valid columnName in the whereKey() method

let query = PFQuery(className: "invFriend")
query.whereKey("columnName", equalTo: "abcd")
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]?, error: NSError?) -> Void in
    for object in objects {
        object.deleteEventually()
    }
}
Sign up to request clarification or add additional context in comments.

2 Comments

sorry, i dont have the objectId, i have the column name. please see the edited Question
Thanks you. Works as Charm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.