[英]How to delete an object in Parse from Swift
I have my class name and friendName. 我有班级名称和friendName。
I dont have the objectId 我没有objectId
What is the code to delete it in Parse from SWIFT? 从SWIFT解析中删除它的代码是什么?
In ObjC, it is something like: 在ObjC中,它类似于:
PFObject *object = [PFObject objectWithoutDataWithClassName:@"invFriend"
objectId:@"abcd"];
[object deleteEventually];
How can i do that from swift without objectId? 没有objectId的情况下怎么办?
Here is the Swift equivalent code. 这是Swift的等效代码。 Note that you must supply a valid columnName in the whereKey() method
请注意,您必须在whereKey()方法中提供有效的columnName。
let query = PFQuery(className: "invFriend")
query.whereKey("columnName", equalTo: "abcd")
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]?, error: NSError?) -> Void in
for object in objects {
object.deleteEventually()
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.