Symbyoz
  • Documentations
  • News
    • Access to Private and Public S3 bucket
    • Create manual database Backup
    • Parse Live Query on Symbyoz
    • Symbyoz back-office "white mark"
    • Cloud Code is now available in a Console
  • Tutorials
    • How to create a new project
    • How to create a custom module
    • How to manage left menu
    • How to manage admin user rights
  • Source code examples
    • Connect to iOS app
    • Connect to Android app
    • Create & Save Object
    • Get Object
    • Delete Object
    • User Management
    • Queries
    • Subclasses
    • Cloud Code
Powered by GitBook
On this page

Was this helpful?

  1. Source code examples

Get Object

PreviousCreate & Save ObjectNextDelete Object

Last updated 6 years ago

Was this helpful?

Get a whole Object using a :

import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.GetCallback;
import com.parse.ParseException;

public void getObject()
{
  ParseQuery<ParseObject> query = ParseQuery.getQuery("ClassName");
  query.getInBackground("objectId", new GetCallback<ParseObject>() 
  {
    public void done(ParseObject object, ParseException e) 
    {
      if (e == null) 
      {
        // your object will be returned here
      } 
      else 
      {
        // something went wrong, check the exception for more infos
      } 
    }
  });
}
import Parse
​
class testVC: UIViewController
{
    override func viewDidLoad()
    {
        super.viewDidLoad()
        self.getObjet(id:"AB1234")
    }
​
​
    func getObjet(id:String)
    {
        let query = PFQuery.init(className: "ClassName")
        query.getObjectInBackground(withId: id)  
    }
}

Get the values out of the Object:

import com.parse.ParseObject;

public void getSomeValues(ParseObject object)
{
    int age = object.getInt("age");
    String userName = object.getString("userName");
    boolean isFunny = object.getBoolean("isFunny");
    ParseObject = object.getParseObject("customObject");
}

Special values that have their own accessors:

import com.parse.ParseObject;

public void getSpecialValues(ParseObject object)
{
    String objectId = object.getObjectId();
    Date updatedAt = object.getUpdatedAt();
    Date createdAt = object.getCreatedAt();
    ParseACL acl = object.getACL();
}

Refresh an object that you already have in memory with the latest data:

import com.parse.ParseObject;
import com.parse.GetCallback;
import com.parse.ParseException;

public void refreshObject(ParseObject object)
{
    object.fetchInBackground(new GetCallback<ParseObject>() 
    {
      public void done(ParseObject object, ParseException e) 
      {
        if (e == null) 
        {
          // Success!
        } 
        else 
        {
          // Failure!
        }
      }
    });
}

Query