0 Replies
      Latest reply on Jan 31, 2018 9:03 PM by NahImGood
      NahImGood Level 1 Level 1 (0 points)

        Hello,

        This is my first time posting in a forum. I have a set up data base using parse. My class name im looking in is "Users". Im trying to pull the assigned "userpropic" PFFIle image and display it in a ImageViewController.

        
        var query = PFQuery(className: "User")
                query.findObjectsInBackground(block: { (object, error) in
                        if error != nil{
                            print(error)
                        }else{
                            if let userpic = object as! UIImage {
                            query.whereKey("objectId", equalTo: self.passedInfo)
                            query.getObjectInBackground(withId: "userpropic")
                        }
                    }
                    UserFrontImage.image = object
                    self.userNameLabel.text = self.passedInfo
                    self.reloadInputViews()
                  
                })
            }
        

        here is my code. So in my mind i have started the query in the class Users. my passedInfo variable is the selected rows objectID that is unique to each individual user. and then im trying to get the Picture that is under the row name userpropic. Im very new to swift and i apoligize in advance for my complete spaghetti code. i would also like to know how to cast from a PFObject into a UIImage.

        My end goal is to grab a image stored on my parse server using a unique ID and display it in a ImageViewcontroller. Thank you to anyone who takes the time to assist me!