Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
解析Swift中导致ACL写入权限更改为objectId的奇怪错误_Swift_Parse Platform_Swift2 - Fatal编程技术网

解析Swift中导致ACL写入权限更改为objectId的奇怪错误

解析Swift中导致ACL写入权限更改为objectId的奇怪错误,swift,parse-platform,swift2,Swift,Parse Platform,Swift2,首先,这是我的解析表在向riderRequest表插入一行后的样子。插入后,用于公共写入的我的ACL默认为用户表的objectId var riderRequest = PFObject(className: "riderRequest") riderRequest["username"] = PFUser.currentUser()?.username riderRequest["location"] = PFGeoPoint(latitude: latitud

首先,这是我的解析表在向riderRequest表插入一行后的样子。插入后,用于公共写入的我的ACL默认为用户表的objectId

var riderRequest = PFObject(className: "riderRequest")
        riderRequest["username"] = PFUser.currentUser()?.username
        riderRequest["location"] = PFGeoPoint(latitude: latitude, longitude: longitude)

        riderRequest.saveInBackgroundWithBlock { (success, error) -> Void in
            if(success)
            {
                self.callUberButton.setTitle("Cancel Uber", forState: UIControlState.Normal)
            }
            else
            {
                self.displayAlert("Could not call uber", message: "Please try again later")
            }
        }
riderRequest表格

用户表格

这是我的代码,它将新行插入我的riderRequest表中

var riderRequest = PFObject(className: "riderRequest")
        riderRequest["username"] = PFUser.currentUser()?.username
        riderRequest["location"] = PFGeoPoint(latitude: latitude, longitude: longitude)

        riderRequest.saveInBackgroundWithBlock { (success, error) -> Void in
            if(success)
            {
                self.callUberButton.setTitle("Cancel Uber", forState: UIControlState.Normal)
            }
            else
            {
                self.displayAlert("Could not call uber", message: "Please try again later")
            }
        }
我的代码与修改ACL的值无关。 我似乎无法理解这一点,为什么要修改ACL值

任何帮助都将不胜感激。
非常感谢您的帮助。

查看您的AppDelegate。很可能存在一个默认ACL,它看起来像这样

// Enable public read access by default, with any newly created PFObjects belonging to the current user
let defaultACL: PFACL = PFACL()
defaultACL.publicReadAccess = true
PFACL.setDefaultACL(defaultACL, withAccessForCurrentUser: true)

您是否创建了默认ACL?我的默认ACL如下所示
let defaultACL=PFACL()
defaultACL.setPublicReadAccess(true)
PFACL.setDefaultACL(defaultACL,withAccessForCurrentUser:true)
我的AppDelegate中的默认ACL代码如下所示
让defaultACL=PFACL()
defaultACL.setPublicReadAccess(true)
PFACL.setDefaultACL(defaultACL,withAccessForCurrentUser:true)
我读了默认ACL上的解析文档,你知道我是
setPublicReadAccess(true)
还是
setPublicWriteAccess(true)
在我的riderRequest表中插入新行时?这与此完全相同,但Parse SDK版本已过时
setPublicReadAccess
已更改为属性,如我的示例中最新版本中所示。然而,这正是导致您拥有公共读取权限,但只有当前用户可以写入的原因。如果你想让公共阅读和公共写作,把这三行注释掉。解析默认为公共读和写write@SwiftEveryday这完全取决于你和你想完成什么。通常,您不希望其他人能够修改彼此的对象,这意味着公共读取和私有写入(对于用户)。如果您想要公共读写,您可以注释掉应用程序委托中的默认ACL代码,或者手动将对象的ACL设置为您提到的公共读写。我会记住这一点。非常感谢你们的帮助和建议,有你们这样有经验的人来指导我,这真的加快了我的学习过程。