[英]parse.com clarification of ACL (object not found for update)
I got the error "Error: object not found for update (Code: 101, Version: 1.2.9)" 我收到错误“错误:找不到要更新的对象(代码:101,版本:1.2.9)”
I was told that this error "is typically returned when the current user does not have permission to write to the object in question." 有人告诉我,此错误“通常在当前用户没有写问题对象权限时返回。”
Please help me make sure I understand ACL. 请帮助我确保我了解ACL。 I have the following code in my delegate:
我的代表中有以下代码:
PFACL *defaultACL = [PFACL ACL];
[defaultACL setPublicReadAccess:YES];
[PFACL setDefaultACL:defaultACL withAccessForCurrentUser:YES];
(1) So does that mean that for any PFObject I create during the current session, only the current user will be able to make changes to that object, unless I specify through a session of the current user other users who are allowed write access? (1)那是否意味着对于我在当前会话期间创建的任何PFObject,只有当前用户才能对该对象进行更改,除非我通过当前用户的会话指定了其他允许写访问权限的用户?
(2) Which I would do using the following code (from parse documentation)? (2)使用下面的代码(来自解析文档),我该怎么做?
PFObject *groupMessage = [PFObject objectWithClassName:@"Message"];
PFACL *groupACL = [PFACL ACL];
// userList is an NSArray with the users we are sending this message to.
for (PFUser *user in userList) {
[groupACL setReadAccess:YES forUser:user];
[groupACL setWriteAccess:YES forUser:user];
}
groupMessage.ACL = groupACL;
[groupMessage saveInBackground];
(3) Now suppose I have a brand new PFUser whom I want to be able to edit an existing PFObject during his current session, but who is not included in the ACL for that existing object. (3)现在假设我有一个全新的PFUser,我希望他可以在其当前会话期间编辑现有的PFObject,但是该用户不包含在该现有对象的ACL中。 How can I enable that user to edit the object?
如何使该用户编辑对象? Would I have to use cloud code to add him to the ACL list?
我是否必须使用云代码将他添加到ACL列表中? A code example would be appreciated.
代码示例将不胜感激。
Thank you. 谢谢。
Using createWithoutData to set the referenced object helped me to solve this problem. 使用createWithoutData设置引用的对象可以帮助我解决此问题。
myObject.put("item", ParseObject.createWithoutData(<SUB CLASS>.class, <Your object item>));
myObject.saveInBackground();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.