Académique Documents
Professionnel Documents
Culture Documents
The platform provides a complete backend solution for the mobile application.
Apps
you create an App for each of your mobile applications. Each App has its own
application id and client key that you apply to your SDK install. Your account on Parse
can accommodate multiple Apps. This is useful even if you have one application, since
you can deploy different versions for test and production.
Objects
The PFObject
Storing data on Parse is built around the PFObject. Each PFObject contains key-value
pairs of JSON-compatible data. This data is schemaless, which means that you don't
need to specify ahead of time what keys exist on each PFObject. You simply set
whatever key-value pairs you want, and our backend will store it.
Keys must be alphanumeric strings. Values can be strings, numbers, booleans, or even
arrays and dictionaries - anything that can be JSON-encoded.
Saving Objects
The interface is similar to a NSMutableDictionary
After the code runs, you will probably be wondering if anything really happened. To
make sure the data was saved, you can look at the Data Browser in your app on Parse.
Retrieving Objects
If you have the objectId, you can retrieve the wholePFObject using a PFQuery.
This is an asynchronous method, with variations for using either blocks or callback
methods:
to saveEventually (and deleteEventually) are executed in the order they are called,
so it is safe to call saveEventually on an object multiple times.
Updating Objects
Updating an object is simple. Just set some new data on it and call one of the save
methods. Assuming you have saved the object and have the objectId, you can retrieve
the PFObject using a PFQuery and update its data
Counters
The above example contains a common use case. The "score" field is a counter that
we'll need to continually update with the player's latest score. Using the above method
works but it's cumbersome and can lead to problems if you have multiple clients trying
to update the same counter.
Arrays
To help with storing array data, there are three operations that can be used to atomically
change an array field:
Deleting Objects
To delete an object use: deleteInBackground
If you want to run a callback when the delete is confirmed, you can use
the deleteInBackgroundWithBlock: ordeleteInBackgroundWithTarget:selector
methods. If you want to block the calling thread, you can use the delete method.
Relational Data
Objects can have relationships with other objects. To model this behavior,
any PFObject can be used as a value in other PFObjects. Internally, the Parse
framework will store the referred-to object in just one place, to maintain consistency.
Data Types
Parse also supports NSDate, NSData, and NSNull.
You can nest NSDictionary and NSArray objects to store more structured data within a
single PFObject.
Some examples: