Parse @ R/GA
Last week Parse‘s CEO & Founder Ilya Sukhar visited the R/GA offices in New York to introduce our development teams to the Parse platform.
Parse.com’s mission is to abstract backend functionality into one scalable and fully featured platform. While it’s particularly powerful for mobile apps, there’s no limit to how developers can integrate it into their projects. They provide built-in support for features like data storage and browsing, push notifications, user registration, and social authentication.
I’ve been using Parse.com for a few months so it was great to meet Ilya and learn more about the company, their products and how they work. Ilya focused on their four core products: Parse Data, Parse Push, Parse Social and Cloud Code.
Parse Data
In one of the apps I am building parse is being used to store user data, and sketches the users are saving. The sketches are saved as JPGs in parse.
This code snippet shows how I am storing the user info and the sketches: Once the information is saved, I can see the data in the Parse Data Browser which lets you view, edit, or delete the information from any browser. Parse Push From your app you can send a notification with the following code: Parse Social This code snippet shows how I am logging in with Facebook in my app: Once the user is successfully logged you can request additional information from Facebook or share my sketch with my friends. Cloud Code You can see the full cloud code here: https://gist.github.com/jtubert/5091694 The platform is still expanding. When I asked Ilya if they were planning to add scheduled jobs to their platform, he confirmed it’s expected in the next few weeks. I’ve found that Parse truly lives up to its lofty goals. Parse heralds a bright future for application developers.
PFObject *photo = [PFObject objectWithClassName:kPAPPhotoClassKey]
[photo setObject:[PFUser currentUser] forKey:kPAPPhotoUserKey];
[photo setObject:self.photoFile forKey:kPAPPhotoPictureKey];
[photo setObject:self.thumbnailFile forKey:kPAPPhotoThumbnailKey];</span></span></span>
// photos are public, but may only be modified by the user who uploaded them
PFACL *photoACL = [PFACL ACLWithUser:[PFUser currentUser]];
[photoACL setPublicReadAccess:YES];
photo.ACL = photoACL;
[photo saveInBackground];

Adding Push notification to my app was really simple using their technology. You still have to add the Objective-C code necessary to handle the notifications but their platform allows you to send the notification via code or their user interface.
[PFPush sendPushMessageToChannelInBackground:@"" withMessage:@"A new sketch was shared with you!"];
You can do the same thing logging in to their site:
I added facebook login to my app so the user can save sketches and share them with their facebook friends. Parse includes the Facebook SDK embedded within SDK and takes care of storing the user’s information securely.NSArray *permissionsArray = @[ @"photo_upload", @"publish_stream",@"user_about_me", @"user_relationships", @"user_birthday", @"user_location"];
// Login PFUser using facebook
[PFFacebookUtils logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error) {
if (!user) {
if (!error) {
NSLog(@"Uh oh. The user cancelled the Facebook login.");
} else {
NSLog(@"Uh oh. An error occurred: %@", error);
}
} else if (user.isNew) {
NSLog(@"User with facebook signed up and logged in!");
} else {
NSLog(@"User with facebook logged in!");
}
}];
You may find the need for a custom service or business rules. That’s where Cloud Code comes into play.
In my app, users are allowed to post whether they are happy or unhappy, and then give reason. On the backend, I had to build a method that returns how many people in certain locations (or based on some keywords) were happy and unhappy.
The code is written in javascript and pushed to the server using a CLI similar to Heroku’s.

