Parse: 5 tricks that won YC Hacks

862 views

Published on

A quick overview of Parse for the YC Hacks info session

Published in: Engineering
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
862
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
7
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Parse: 5 tricks that won YC Hacks

  1. 1. ParseThomas Bouldin @inlined
  2. 2. Which is better:
 To expend great effort
 Or achieve great results?
  3. 3. Making mobile apps is hard
  4. 4. Database REST API Z Z Z Server ++ + users + security CachingNetworking + + The fun part! no no no no no yes!
  5. 5. Parse Pillars Push AnalyticsCore
  6. 6. Parse Core
  7. 7. Storing Data Parse Data PFObject is like an NSMutableDictionary in the cloud
 PFObject *armor = [PFObject objectWithClassName:@“Armor”]; [armor setObject:@“Shield” forKey:@“name”]; armor[@“price”] = @50; [armor saveInBackground];
  8. 8. Storing Data Parse Data ! 
 Armor  *shield  =  [Armor  object]
 shield.name  =  @“shield”;
 shield.cost  =  50; Can also use like a class:
  9. 9. Fetching Data Parse Data PFQuery  *query  =  [Armor  query];   [query  whereKey:@“name”  equalTo:@“shield”];
 [query  whereKey:@“cost”  lessThan:@50];   [query  findObjectsInBackgroundWithBlock:
    ^(NSArray  *objects,  NSError  *error)  {
    /*  ...  */
 }];
  10. 10. Signing Up Parse Social PFUser  *user  =  [PFUser  user];   user.username  =  @“inlined”;
 user.password  =  @“YC  H4cks”;   [user  signUpInBackgroundWithBlock:
  ^(BOOL  success,  NSError  *error)  {
    /*  ...  */
 }];
  11. 11. Social Integration Parse Social [PFFacebookUtils  logInWithPermissions:nil
                                                                block:
  ^(PFUser  *user,  NSError  *error)  {
    /*  ...  */
 }];
  12. 12. UI Controls Parse Social Replace login code with built-in view
 controllers Fully customizable
  13. 13. Parse Cloud Code For when server-side code is needed or easier Trusted execution environment Data pipeline integration Third party integration Hosting static and dynamic resources
  14. 14. Parse Cloud Code Parse.Cloud.afterSave(
        “Message”,  function(request)  {          Parse.Push.send({
            channel:  request.object.get(“room”),
            data:  {
                alert:  request.object.get(“message”)
            }
        });
 });
  15. 15. Parse Push
  16. 16. Registering Parse Push [PFPush  storeDeviceToken:deviceToken];   [PFPush  subscribeToChannelInBackground:@“hack”];
  17. 17. Sending Parse Push PFPush  *push  =  [PFPush  push];   push.channel  =  @“hack”;   push.message  =  @“Move  fast  and  build  things”;   [push  sendInBackgroundWithBlock:
    ^(BOOL  succeeded,  NSError  *error)  {
    /*  ...  */
 }];
  18. 18. Parse Analytics
  19. 19. App Opens Parse Analytics  [PFAnalytics
        trackAppOpenedWithLaunchOptions:launchOptions];
  20. 20. Custom Events Parse Analytics NSDictionary  *dimensions  =  @{
    @“product”:  @“pwnies”,
    @“location”:  @“US-­‐west”,
    @“login”:  @“Facebook”,
 };
 [PFAnalytics  trackEvent:@“purchase”
                          dimensions:dimensions];      
  21. 21. Automatic Tracking Parse Analytics
  22. 22. Automatic Tracking Parse Analytics
  23. 23. Let’s Build parse.com/tutorials
 parse.com/apps/quickstart github.com/ParsePlatform/ P
  24. 24. Backup
  25. 25. Access Control Parse Social //  Automatically  own  all  objects  you  create  but
 //  allow  everyone  to  read  them.
 PFACL  *acl  =  [PFACL  ACL];
 [acl  setPublicReadAccess:YES];   [PFACL  setDefaultACL:acl
  withAccessForCurrentUser:YES]
  26. 26. Logging In Parse Social PFUser  *user  =
    [PFUser  logInWithUsername:@“inlined”
                                      password:@“YC  H4cks”];   
 //  From  now  on:
 PFUser  *user  =  [PFUser  currentUser];
  27. 27. Storing Data Parse Data Can also use like a class: 
 @interface  Armor  :  PFObject<PFSubclassing>
 //  Properties  are  synthesized  with  @dynamic
 @property  (nonatomic)  NSString  *name;
 @property  (nonatomic)  int  price;
 @end

×