- Store and retreive data to/from Parse
- Understand the fundamental difference between local storage and remote storage
Pre-app setup
- Create a Parse application on https://parse.com
- Get
Application ID
andClient Key
(Settings -> Keys)
Installation
pod 'Parse', '~> 1.8'
Application setup
// AppDelegate.h
#import <Parse/Parse.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Parse setApplicationId:@"9348j2p934fj2p94f8j23"
clientKey:@"2398fj23-98fj2-398fj23f"];
return YES;
}
Add object
PFObject *object = [PFObject objectWithClassName:@"TestObject"];
object[@"name"] = @"Mike";
[object saveInBackground];
Find objects
PFQuery *query = [PFQuery queryWithClassName:@"TestObject"];
[query findObjectsInBackgroundWithBlock:^(NSArray * objects, NSError * error) {
NSLog(@"%@", objects);
}];
TOGETHER WE BUILD!!!!!!!