![Page 1: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/1.jpg)
Writing Parse AppsArmenian Dev Meetup
![Page 2: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/2.jpg)
What is MBaaS?
![Page 3: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/3.jpg)
Why Parse?
● Learning curve● Documentation● Examples● Support
![Page 4: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/4.jpg)
● Platform for mobile developers● Founded Jun 2011, YC● Acquired by Facebook, Apr 2013● Built on Amazon Web Services
Parse
![Page 5: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/5.jpg)
Parse Architecture
![Page 6: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/6.jpg)
Products
![Page 7: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/7.jpg)
Client SDKs
![Page 8: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/8.jpg)
Quickstart
![Page 9: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/9.jpg)
Object Model
PFObject - unstructured key-value data objectPFObject *book = [PFObject objectWithClassName:@”Book”];book[@”title”] = @”The Little Prince”;[book saveInBackground];...int pages = [[book objectForKey:@”pages”] intValue];NSString *objectId = hotel.objectId;NSDate *createdAt = hotel.createdAt; (updatedAt)...[book saveEventually];
![Page 10: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/10.jpg)
QueriesPFQuery *query = [PFQuery queryWithClassName:@”Book”];[query getObjectInBackgroundWithId:@”xWMyZ4YEGZ” block:^(PFObject *book, NSError *error) {
NSLog(@”%@”, book);}…[query whereKey:@”author” equalTo:@”Jack London”];[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError
*error) {…}]…query.limit = 5; query.skip = 10;[query orderByAscending:@”title”];[query selectKeys:@[@”title”, @”pages”];
![Page 11: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/11.jpg)
Relational QueriesPFQuery *query = [PFQuery queryWithClassName:@”Comment”];[query whereKey:@”book” equalTo:theBook];…PFQuery *innerQuery = [PFQuery queryWithClassName:@”Book”];[innerQuery whereKeyExists:@”image”];PFQuery *query = [PFQuery queryWithClassName:@”Comment”];[query whereKey:@”book” matchesQuery:innerQuery];…query.cachePolicy = kPFCachePolicyNetworkElseCache;[query includeKey:@”author”];…PFQuery *query = [PFQuery orQueryWithSubqueries:@[queryA, queryB]];
![Page 12: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/12.jpg)
Files and ImagesNSData *data = UIImagePNGRepresentation(image); // (up to 10MB)PFFile *file = [PFFile filwWithName:@”attachment.png” data:data];[file saveInBackground]; …PFObject *message = [PFObject objectWithClassName:@”Message”];message[@”attatchment”] = file;[message saveInBackground];…PFFile *imageFile = article[@”imageFile”];[imageFile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {if (!error) {UIImage *image = [UIImage imageWithData:data];}];
![Page 13: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/13.jpg)
Users
PFUser - user subclass of PFObjectPFUser *user = [PFUser user];user.username = @“myname”; // requireduser.password = @”mypass”; // required on signupuser.email = @”[email protected]”; // optional[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error){...}];[PFUser logInUsernameInBackground@”myname” password:@”mypass” block:^(PFUser *user, NSError *error) {...}];PFUser *currentUser = [PFUser currentUser];[PFUser logOut];[PFUser requestPasswordRequestForEmailInBackground:@”[email protected]”];
![Page 14: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/14.jpg)
Social Integrations
● Facebook and Twitter● Login & Signup● Link & unlinking existing users● API calls
![Page 15: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/15.jpg)
Cloud Code
● Custom code on server● Command line tool (parse new, deploy)Parse.Cloud.define(“hello”, function(request, response) {
response.success(“hello world”); // 15 sec limit});[PFCloud callFunctionInBackground:@”hello” withParameters:@{}
block:^(NSString *results, NSError *error) {...} }];Parse.Cloud.beforeSave(“Book”, …); // 3 sec limitParse.Cloud.afterDelete(Parse.User, …);
![Page 16: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/16.jpg)
UI Components
● PFLoginViewController● PFSignUpViewController ● PFQueryTableViewController● PFImageView● PFTableCellView
![Page 17: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/17.jpg)
Data Browser
![Page 18: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/18.jpg)
Analytics
![Page 19: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/19.jpg)
Pricing
![Page 20: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/20.jpg)
Recommendations
● Prototyping● Wrap Parse API● Development vs. Production● ACL● Cloud Code
![Page 21: Introduction to Parse backend for mobile developers](https://reader036.vdocuments.us/reader036/viewer/2022062313/559367a61a28ab9f2d8b469f/html5/thumbnails/21.jpg)
Q&A
Thanks!