How can I get back data of user on Parse?

前端 未结 1 737
清歌不尽
清歌不尽 2021-01-23 18:57

I want to get back data in \"requestActive\" in \"User\" on Parse.t

I try this :

var user = PFUser()
var requestActive = user[\"requestActive\"]
<         


        
相关标签:
1条回答
  • 2021-01-23 20:02

    You are declaring user at the top level of your view controller.

    But then, still at the root level, you try to use it with user["requestActive"]: you can't do that.

    You have to use user in a method, for example viewDidLoad.

    So let's say the type of user["requestActive"] would be a String (just for the example), you would do something like:

    var user = PFUser()
    var requestActive: String?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        requestActive = user["requestActive"]
    }
    

    Of course, you have to replace String with your actual type.

    0 讨论(0)
提交回复
热议问题