Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Parse @ NSBarcelona

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →
Avatar for Saul Baro Saul Baro
November 26, 2013

Parse @ NSBarcelona

Avatar for Saul Baro

Saul Baro

November 26, 2013

Other Decks in Technology

Transcript

  1. PRODUCT OVERVIEW Parse Data ! Parse Push ! Parse Social

    ! Parse Hosting ! Parse Analytics ! Cloud Code
  2. SUPPORTED PLATFORMS iOS ! OS X ! Android ! Javascript

    ! Windows Phone 8 Windows 8 ! .NET ! Xamarin ! Unity ! Rest API
  3. INTEGRATING IT INTO YOUR PROJECT Sign up https://parse.com/#signup ! Add

    the library to your project ! Setting your application ID and Client Key [Parse setApplicationId:@"APPLICATION_ID" clientKey:@"CLIENT_KEY"]; DONE!
  4. PARSE DATA Cloud storage Store and retrieve your data !

    Share data between devices and platforms ! Manage your data using the Data Browser
  5. PARSE DATA: USAGE Create a new Parse object PFObject *gameScore

    = [PFObject objectWithClassName:@"GameScore"]; gameScore[@"score"] = @1337; gameScore[@"playerName"] = @"Sean Plott"; gameScore[@"cheatMode"] = @NO; [gameScore saveInBackground]; // Or use [gameScore saveEventually];
  6. PARSE DATA: USAGE Retrieve an object PFQuery *query = [PFQuery

    queryWithClassName:@"GameScore"]; [query getObjectInBackgroundWithId:@"xWMyZ4YEGZ" block:^(PFObject *gameScore, NSError *error) { // Do something with the returned PFObject in the gameScore variable. }];
  7. PARSE DATA: USAGE Delete an object [myObject deleteInBackground]; ! Delete

    a field [myObject removeObjectForKey:@"playerName"]; [myObject saveInBackground];
  8. PARSE DATA: USAGE Security ACLs { "*":{"read":true}, "sampleUserId":{"write":true,"read":true} } {

    "role:RoleName":{"read":true}, "sampleUserId":{"write":true,"read":true} } Master Key
  9. Subclassing PFObject *shield = [PFObject objectWithClassName:@"Armor"]; shield[@"displayName"] = @"Wooden Shield”;

    ! ⬇️ ! Armor *shield = [Armor object]; shield.displayName = @"Wooden Shield"; PARSE DATA: TIPS AND TRICKS
  10. Subclassing You class has to conform to the PFSubclassing protocol

    ! Implement the method parseClassName ! Import PFObject+Subclass ! Call [YourClass registerSubclass] before setting appId and clientKey PARSE DATA: TIPS AND TRICKS
  11. Retrieve related objects in a single query [query includeKey:@"relatedObject"]; !

    [query includeKey:@"relatedObject.otherRelatedObject"]; PARSE DATA: TIPS AND TRICKS
  12. PARSE PUSH Send push notifications Using the web console, REST

    API or client SDKs ! Push composer Targeting Scheduling
  13. PARSE PUSH: USAGE Registering your device In didRegisterForRemoteNotificationsWithDeviceToken ! PFInstallation

    *currentInstallation = [PFInstallation currentInstallation]; [currentInstallation setDeviceTokenFromData:deviceToken]; [currentInstallation saveInBackground];
  14. PARSE PUSH: USAGE Sending pushes Usually, using the Web console,

    the REST API or Cloud Code Using the client SDKs (disabled by default)
  15. PARSE PUSH: USAGE Other Register to channels Send pushes to

    channels ! Register user preferences for advanced targeting ! Send pushes to queries
  16. PARSE SOCIAL Handle user sign up and log in Automatic

    email verification ! Very simple password resetting ! Sign up and log in using Facebook and Twitter
  17. PARSE SOCIAL: USAGE Sign up PFUser *user = [PFUser user];

    user.username = @"mario"; user.password = @"mushroomkingdom"; [user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { // Do something }];
  18. PARSE SOCIAL: USAGE Log in [PFUser logInWithUsernameInBackground:@“myname" password:@"mypass" block:^(PFUser *user,

    NSError *error) { if (user) { // Do stuff after successful login. } else { // The login failed. Check error to see why. } }];
  19. PARSE SOCIAL: USAGE Facebook login [PFFacebookUtils logInWithPermissions:permissions block:^(PFUser *user, NSError

    *error) { if (!user) { NSLog(@"Uh oh. The user cancelled the Facebook login."); } else if (user.isNew) { NSLog(@"User signed up and logged in through Facebook!"); } else { NSLog(@"User logged in through Facebook!"); } ];
  20. PARSE SOCIAL: TIPS AND TRICKS PFUser Subclassing + (MJUser *)user

    { MJUser *user = [[self class] object]; return user; } ! + (instancetype)object { MJUser *user = (MJUser *)[super object]; // Do Stuff return user; }
  21. PARSE ANALYTICS Measure app usage App open rates ! Number

    of API calls ! Analytics on API requests based on: REST verbs Device type Parse class
  22. PARSE ANALYTICS: USAGE Track a custom data point NSDictionary *dimensions

    = @{ @"priceRange": @"1000-1500", @"customerType": @"renter", @"age": @"22-25" }; // Send the dimensions to Parse along with the 'search' event [PFAnalytics trackEvent:@"search" dimensions:dimensions];
  23. PARSE HOSTING Web site hosing Static and dynamic websites !

    Simple deployment using their command line tools ! Uses the Express framework to create dynamic websites
  24. CLOUD CODE Run custom code in parse servers Javascript in

    the cloud ! Define functions that can be called from your apps ! Schedule tasks ! Modules provided by parse to use other services
  25. CLOUD CODE: LIMITATIONS Functions have a limited execution of 15

    seconds ! Jobs have a limited execution of 15 minutes Basic plan users can have one job running concurrently Pro plan users can have two Any other job will be queued up
  26. CLOUD CODE: USAGE Command Line Tool Installation ! curl -s

    https://www.parse.com/downloads/cloud_code/installer.sh | sudo /bin/bash
  27. CLOUD CODE: USAGE Setting up cloud code $ parse new

    MyCloudCode Email: [email protected] Password: 1:MyApp Select an App: 1 ! It creates an empty app in the MyCloudCode folder
  28. CLOUD CODE: USAGE Create a function Parse.Cloud.define("hello", function(request, response) {

    response.success("Hello world!”); }); ! [PFCloud callFunctionInBackground:@“hello" withParameters:@{} block:^(NSString *result, NSError *error) { // Result is @"Hello world!"; }];
  29. CLOUD CODE: USAGE Create a website $ parse generate express

    ! Add require(‘cloud/app.js'); to your main.js ! Hosted at your-custom-subdomain.parseapp.com/hello
  30. CLOUD CODE: USAGE More complex stuff Call a function before

    of after saving an object of a specific class
 Call a function before or after a delete
  31. CLOUD CODE: USAGE Create a job Parse.Cloud.job("userMigration", function(request, status) {

    // Do stuff // Finish successfully status.success("Migration completed successfully."); // Finish unsuccessfully status.error("Uh oh, something went wrong."); });
  32. CLOUD CODE: TIPS AND TRICKS The Master Key Allows the

    task to modify data from any user ! The master key can only be used in: Cloud code The REST API
  33. CLOUD CODE: TIPS AND TRICKS Don’t trust the available modules

    Sometimes they are not up to date ! They may have errors ! Nearly impossible to debug
  34. PRICING Basic plan Free 1 million API requests / month

    (7 cents per 1000 over) 1 million push notifications / month (7 cents per 1000 over) No email templates No push scheduling and targeting
  35. PRICING Pro plan $199 / month 15 million API requests

    per month (5 cents per 1000 over) 5 million push notifications per month (5 cents per 1000 over) Custom email templates Push scheduling and targeting
  36. ALTERNATIVES Helios.io Open-source Needs a Rails server iOS only Server

    Modules: Data, Push, Logging & Analytics, … Client integration: Remote configuration, push registration, A/B testing, Push notification registration, remote logging, AFNetworking, AFIncrementalStore
  37. ALTERNATIVES Firebase Web, Node.js, iOS/OS X, Java/Android, REST API Price

    goes from free to $1499 / month Data in the cloud Real-time synchronization
  38. ALTERNATIVES StackMob iOS, Android, JavaScript Price goes from ? to

    ? Data, Push, Custom Code, Web hosting, Social,…
  39. THANK YOU! ! ! ! ! ! You can find

    me on Twitter @saulbaro