使用PFObject Swift分配PFUser

时间:2015-05-18 17:30:56

标签: ios parse-platform xcode6.3.1

如何将PFUser添加到PFObject,现在这是我的代码:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:ListBucket"],
      "Resource": ["arn:aws:s3:::bucket-name"]
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:DeleteObject"
      ],
      "Resource": ["arn:aws:s3:::bucket-name/*"]
    }
  ]
}

那么我如何能够为用户分配用户,用户已经登录,那么如何将此PFObject分配给当前登录的用户!

我正在使用iOS Swift - Xcode 6.3.1

谢谢, 乔治巴洛

1 个答案:

答案 0 :(得分:0)

在Objective-C中,您可以通过调用[PFUser currentUser]来引用登录用户,该PFUser.currentUser()应转换为Swift user。假设您有一个名为 if let user = PFUser.currentUser(), username = user.username { user["column-name-in-parse-data"] = username } 的gameScore专栏,您可以在保存gameScore之前添加以下代码:

LIBS += -L$$PWD/path_relative_to_pro_file/lib -lmylibfile1 -lmyflibfile2
INCLUDEPATH += $$PWD/path_relative_to_pro_file/lib/include