我需要在Parse中设置ACL,但我不知道将代码放在哪里。
Objective-C中的代码如下:
PFUser *user = [PFUser currentUser];
user.ACL = [PFACL ACLWithUser:user];
我该放在哪里?还; 有人知道如何将其快速翻译吗?
任何建议如何进行将不胜感激。
我之前在Swift中的Parse上为UserPhoto类做了此操作。这是func中的代码,当用户选择新图像时会调用该代码。ACL部分在第4行:
var userPhoto = PFObject(className: "UserPhoto")
//imageFile is NSData passed to func
userPhoto.setObject(imageFile, forKey: "imageFile")
userPhoto.ACL = PFACL(user: PFUser.currentUser())
userPhoto.setObject(PFUser.currentUser(), forKey: "user")
//save
userPhoto.saveInBackgroundWithBlock({ (success, error) -> Void in
println("Saved new userPhoto to Parse")
})
希望能帮助到你!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句