I'm using the Parse iOS SDK, and I'm creating objects for a particular class (not "_User"). However, I need to modify the ACL of these objects so that anyone can read or write it. Currently, Parse sets the ACL of newly created objects to Public Read and Creator Write.
In short, I'm not sure how to set the ACL of a Parse object to public read/write in Swift.
It's been updated, now it should be done like this:
let acl = PFACL()
acl.publicReadAccess = true
acl.publicWriteAccess = true
yourObject.ACL = acl
let acl = PFACL()
acl.setPublicReadAccess(true)
acl.setPublicWriteAccess(true)
yourObject.ACL = acl
UPDATE:
You can set write permissions to a larger group of users using "roles":
acl.setWriteAccess(true, forRoleWithName:"everyone")
You will have to create the role first.
If you want your ACL settings apply for all objects you create, you can:
AppDelegate.swift
In didFinishLaunchingWithOptions
method
You could see PFACL() is set like this:
let defaultACL = PFACL();
// If you would like all objects to be private by default, remove this line.
defaultACL.setPublicReadAccess(true)
Here, just add:
defaultACL.setPublicWriteAccess(true)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With