SlideShare a Scribd company logo
初めての Parse
                株式会社 ミクシィ
                 田村 航弥




12年7月23日月曜日
agenda

              • @tamotamago
              • what’s Parse?
              • Data Store
              • Query
              • Push Notification


12年7月23日月曜日
@tamotamago について




12年7月23日月曜日
@tamotamago について
              • 田村 航弥
               • 東京 2 年目 iOS App developer
               • mixi for iPhone, iPad 開発
               • http://alpha.mixi.co.jp/2012/10974/
               • tamotamago.com




12年7月23日月曜日
@tamotamago について

              • 第2回 iphone_dev_jp 東京iPhone/Mac勉強会


                                  @k_kinukawa


                     mixi の iOS アプリ開発
                http://alpha.mixi.co.jp/2012/11000/

12年7月23日月曜日
What’s Parse?



12年7月23日月曜日
What’s Parse



              • Parse は BaaS (Backend as a Service)




12年7月23日月曜日
What’s Parse
              • Parse の機能

               • ユーザ認証機能

               • データストア、検索

               • remote notification
               • twitter, facebok SDK をラップ

               • and so on ...
12年7月23日月曜日
12年7月23日月曜日
Parse の導入


              • Parse Quick Start
              • tamotamago.com [Objective-C][Parse]初めての
                Parse ー導入編ー




12年7月23日月曜日
Data Store
              https://parse.com/docs/ios/api/Classes/PFObject.html




12年7月23日月曜日
Data Store


              • Key Value Store
              • ブラウザからデータ閲覧、編集が可能

              • リレーションも持たせることができる



12年7月23日月曜日
Data Store




12年7月23日月曜日
Data Store

   テーブル名みたいなもの      かってにつくられる




              自分でつくっていく

12年7月23日月曜日
Save -blocks-
    PFObject *object = [[PFObject alloc]initWithClassName:@"TestClass"];
    [object setObject:@"tamotamago" forKey:@"name"];
    [object saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
        NSString *result = succeeded ? @"success" : @"error";
        NSLog(@"result : %@", result);
    }];




12年7月23日月曜日
Save -callbacks-
   - (void)viewDidLoad
   {
       [super viewDidLoad];
   ! // Do any additional setup after loading the view, typically from a nib.
       PFObject *object = [[PFObject alloc]initWithClassName:@"TestClass"];
       [object setObject:@"tamotamago2" forKey:@"name"];
       [object saveInBackgroundWithTarget:self selector:@selector(saveCallback:error:)];
   }

   -(void)saveCallback:(NSNumber*)result error:(NSError*)error
   {
       if(!error){
           NSLog(@"%@", result);
       }else{
           NSLog(@"%@", error);
       }
   }




12年7月23日月曜日
Update
    PFObject *object = [[PFObject alloc]initWithClassName:@"TestClass"];
    [object setObject:@"tamotamago3" forKey:@"name"];
    [object saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
        [object setObject:@"tamotamago4" forKey:@"name"];
        [object save];
    }];




                        PFObject が 1 タプル




12年7月23日月曜日
Array Data
 PFObject *object = [[PFObject alloc]initWithClassName:@"TestClass"];
 NSArray *names = [NSArray arrayWithObjects:@"tamotamago5", @"tamotamago6", nil];
 [object addUniqueObjectsFromArray:names forKey:@"names"];
 [object save];




12年7月23日月曜日
Relation -one-to-many-

                          Post


                parent


               Comment   Comment   Comment




12年7月23日月曜日
Relation -one-to-many-
    PFObject *myPost = [PFObject objectWithClassName:@"Post"];
    [myPost setObject:@"I'm Hungry" forKey:@"title"];
    [myPost setObject:@"Where should we go for lunch?" forKey:@"content"];

    // Create the comment
    PFObject *myComment = [PFObject objectWithClassName:@"Comment"];
    [myComment setObject:@"Let's do Sushirrito." forKey:@"content"];

    // Add a relation between the Post and Comment
    [myComment setObject:myPost forKey:@"parent"];

    // This will save both myPost and myComment
    [myComment saveInBackground];




12年7月23日月曜日
Relation -one-to-many-
    PFObject *myPost = [PFObject objectWithClassName:@"Post"];
    [myPost setObject:@"I'm Hungry" forKey:@"title"];
    [myPost setObject:@"Where should we go for lunch?" forKey:@"content"];

    // Create the comment
    PFObject *myComment = [PFObject objectWithClassName:@"Comment"];
    [myComment setObject:@"Let's do Sushirrito." forKey:@"content"];

    // Add a relation between the Post and Comment
    [myComment setObject:myPost forKey:@"parent"];

    // This will save both myPost and myComment
    [myComment saveInBackground];




12年7月23日月曜日
Relation -many-to-many-

                 Post   Post   Post


          like


                 user   user   user




12年7月23日月曜日
Relation -many-to-many-
  Parse blog : A More Scalable Many-to-Many Approach

   PFObject *post2 = [PFObject objectWithClassName:@"Post"];
   [post2 setObject:@"I'm Hungry" forKey:@"title"];
   [post2 setObject:@"Where should we go for dinner?" forKey:@"content"];
   PFRelation *relation = [post2 relationforKey:@"likes"];

   for (PFObject *object in objects){
       [relation addObject: object];
   }

   [post2 save];




12年7月23日月曜日
Relation -many-to-many-
  Parse blog : A More Scalable Many-to-Many Approach

   PFObject *post2 = [PFObject objectWithClassName:@"Post"];
   [post2 setObject:@"I'm Hungry" forKey:@"title"];
   [post2 setObject:@"Where should we go for dinner?" forKey:@"content"];
   PFRelation *relation = [post2 relationforKey:@"likes"];

   for (PFObject *object in objects){
       [relation addObject: object];
   }

   [post2 save];




12年7月23日月曜日
Relation -many-to-many-
  Parse blog : A More Scalable Many-to-Many Approach

   PFObject *post2 = [PFObject objectWithClassName:@"Post"];
   [post2 setObject:@"I'm Hungry" forKey:@"title"];
   [post2 setObject:@"Where should we go for dinner?" forKey:@"content"];
   PFRelation *relation = [post2 relationforKey:@"likes"];

   for (PFObject *object in objects){
       [relation addObject: object];
   }

   [post2 save];




12年7月23日月曜日
Queries
              https://parse.com/docs/ios/api/Classes/PFQuery.html




12年7月23日月曜日
Basic Query




12年7月23日月曜日
Basic Query
  PFQuery *query = [PFQuery queryWithClassName:@"TestClass"];
  [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
      if (!error) {
          // The find succeeded.
          for (PFObject *object in objects){
               NSLog(@"object name -> %@", [object objectForKey:@"name"]);
          }
      } else {
          // Log details of the failure
          NSLog(@"Error: %@ %@", error, [error userInfo]);
      }
  }];




 2012-07-20   13:14:29.786   ParseTest[948:f803]   object   name   ->   tamotamago
 2012-07-20   13:14:29.787   ParseTest[948:f803]   object   name   ->   tamotamago2
 2012-07-20   13:14:29.787   ParseTest[948:f803]   object   name   ->   tamotamago4
 2012-07-20   13:14:29.788   ParseTest[948:f803]   object   name   ->   (null)
 2012-07-20   13:14:29.788   ParseTest[948:f803]   object   name   ->   tamotamago7




12年7月23日月曜日
Basic Query
  PFQuery *query = [PFQuery queryWithClassName:@"TestClass"];
  [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
      if (!error) {
          // The find succeeded.
          for (PFObject *object in objects){
               NSLog(@"object name -> %@", [object objectForKey:@"name"]);
          }
      } else {
          // Log details of the failure
          NSLog(@"Error: %@ %@", error, [error userInfo]);
      }
  }];




 2012-07-20   13:14:29.786   ParseTest[948:f803]   object   name   ->   tamotamago
 2012-07-20   13:14:29.787   ParseTest[948:f803]   object   name   ->   tamotamago2
 2012-07-20   13:14:29.787   ParseTest[948:f803]   object   name   ->   tamotamago4
 2012-07-20   13:14:29.788   ParseTest[948:f803]   object   name   ->   (null)
 2012-07-20   13:14:29.788   ParseTest[948:f803]   object   name   ->   tamotamago7




12年7月23日月曜日
Where 句



              [query whereKey:@"name" equalTo:@"tamotamago"];




12年7月23日月曜日
OrderBy


              [query orderByAscending:@"name"];




12年7月23日月曜日
IN 句

              NSArray *array = [NSArray arrayWithObjects:
                                @"tamotamago",
                                @"tamotamago2",
                                nil];
              [query whereKey:@"name" containedIn:array];




12年7月23日月曜日
Relation query




12年7月23日月曜日
Relation query

   PFQuery *query = [[PFQuery alloc] initWithClassName:@"Post"];
   [query findObjectsInBackgroundWithBlock:^(NSArray *posts, NSError *error) {
       for (PFObject *post in posts){
           PFRelation *relation = [post relationforKey:@"likes"];
           PFQuery *relationQuery = [relation query];
           [relationQuery findObjectsInBackgroundWithBlock:^(NSArray *tamotamagos, NSError *error) {
               for(PFObject *object in tamotamagos){
                   NSLog(@"%@", [object objectForKey:@"name"]);
               }
           }];

         }
   }];




12年7月23日月曜日
Paging




                                           query.skip = 3;
 [query findObjects];
                                           [query findObjects];

    object    name   ->   tamotamago
    object    name   ->   tamotamago2
                                            object name -> (null)
    object    name   ->   tamotamago4
                                            object name -> tamotamago7
    object    name   ->   (null)
    object    name   ->   tamotamago7


12年7月23日月曜日
Push Notification
              https://parse.com/docs/ios/api/Classes/PFPush.html




12年7月23日月曜日
Setup


   https://www.parse.com/tutorials/ios-push-notifications

                    証明書の発行とか




12年7月23日月曜日
Setup




12年7月23日月曜日
Setup
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
    (NSDictionary *)launchOptions
    {
        // Override point for customization after application launch.
        [Parse setApplicationId:@"app id"
                      clientKey:@"client key"];

        [application registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|
         UIRemoteNotificationTypeAlert|
         UIRemoteNotificationTypeSound];

        return YES;
    }

    - (void)application:(UIApplication *)application
    didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken
    {
        // Tell Parse about the device token.
        [PFPush storeDeviceToken:newDeviceToken];
        // Subscribe to the global broadcast channel.
        [PFPush subscribeToChannelInBackground:@""];
    }




12年7月23日月曜日
12年7月23日月曜日
channel



              Push を投げるゾーン




12年7月23日月曜日
channel

    - (void)application:(UIApplication *)application
    didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken
    {
        // Tell Parse about the device token.
        [PFPush storeDeviceToken:newDeviceToken];
        // Subscribe to the global broadcast channel.
        [PFPush subscribeToChannelInBackground:@""];
        [PFPush subscribeToChannelInBackground:@"tamotamago"];
    }




12年7月23日月曜日
channel




                      tamotamago




               Broadcast
12年7月23日月曜日
channel




12年7月23日月曜日
channel


                  tamotamago3




              tamotamago2           tamotamago

                            Broadcast
12年7月23日月曜日
send notification

   PFPush *push = [[PFPush alloc] init];
   NSArray *channels = [NSArray arrayWithObjects:@"tamotamago", nil];
   [push setChannels:channels];
   [push setMessage:@"push test"];
   [push sendPushInBackgroundWithBlock:^(BOOL succeeded, NSError *error)
   {

   }];




12年7月23日月曜日
channel


       push!!
                    tamotamago3




                tamotamago2           tamotamago

                              Broadcast
12年7月23日月曜日
おわりに



12年7月23日月曜日
Others
              • Users
                • https://parse.com/docs/ios/api/Classes/PFUser.html

              • Geo Points
                • https://parse.com/docs/ios/api/Classes/PFGeoPoint.html

              • Facebook Users
                • https://parse.com/docs/ios/api/Classes/PFFacebookUtils.html

              • and so on ...

12年7月23日月曜日
でもお高いんでしょう?




12年7月23日月曜日
12年7月23日月曜日
enjoy



12年7月23日月曜日

More Related Content

PDF
[東京] JapanSharePointGroup 勉強会 #2
PDF
jQuery超入門編
PDF
Yahoo!ボックスAPI Hackday資料
PDF
Yahoo!ボックスAPI Hackathon向け資料
KEY
はじめてのCouch db
PDF
第一回Miim勉強会
PPTX
「Windows 8 ストア アプリ開発 tips」 hokuriku.net vol.11 (2013年1月26日)
PPTX
BPStudy32 CouchDB 再入門
[東京] JapanSharePointGroup 勉強会 #2
jQuery超入門編
Yahoo!ボックスAPI Hackday資料
Yahoo!ボックスAPI Hackathon向け資料
はじめてのCouch db
第一回Miim勉強会
「Windows 8 ストア アプリ開発 tips」 hokuriku.net vol.11 (2013年1月26日)
BPStudy32 CouchDB 再入門

What's hot (19)

PDF
Jetpack datastore入門
PDF
Javaでmongo db
PPTX
MongoDB: システム可用性を拡張するインデクス戦略
PDF
Jetpack Workshop
PDF
swooleを試してみた
PDF
Try Jetpack
PDF
Django boodoo
PPTX
J qmobiはjqueryから軽量化しているか
PPTX
CakePHP+Smartyハイブリッドによるラクラク開発
PDF
EucalyptusのHadoopクラスタとJaqlでBasket解析をしてHiveとの違いを味わってみました
PDF
Grails-1.1を斬る!~Grails-1.1からのチーム開発~ in Tokyo
PDF
JavaScriptの落とし穴
PDF
月間10億pvを支えるmongo db
PDF
G*workshop 2011/11/22 Geb+Betamax
PDF
PDF
XHR2 Wonder Land
PDF
Vue.jsでFormをAtomic Designしてみた時のコンポーネント間のデータのやりとり
PDF
Paging Libraryの利用をやめたいお気持ち表明
PDF
ふぉとぶらり+LODAC -iPhoneアプリでのSPARQLでの活用事例-
Jetpack datastore入門
Javaでmongo db
MongoDB: システム可用性を拡張するインデクス戦略
Jetpack Workshop
swooleを試してみた
Try Jetpack
Django boodoo
J qmobiはjqueryから軽量化しているか
CakePHP+Smartyハイブリッドによるラクラク開発
EucalyptusのHadoopクラスタとJaqlでBasket解析をしてHiveとの違いを味わってみました
Grails-1.1を斬る!~Grails-1.1からのチーム開発~ in Tokyo
JavaScriptの落とし穴
月間10億pvを支えるmongo db
G*workshop 2011/11/22 Geb+Betamax
XHR2 Wonder Land
Vue.jsでFormをAtomic Designしてみた時のコンポーネント間のデータのやりとり
Paging Libraryの利用をやめたいお気持ち表明
ふぉとぶらり+LODAC -iPhoneアプリでのSPARQLでの活用事例-
Ad

Viewers also liked (10)

PDF
Generic Parse Server
PPT
Parse Server Open Source
PPTX
Introduction Node.js
PPTX
Inside Logic Apps
PPTX
Serverless Architecture - Azure Logic apps
PDF
Tomasz Janczuk - Webtaskalifragilistexpialidocious
PDF
Anatomy of a Modern Node.js Application Architecture
PPTX
Introduction to Node.js
PPTX
Serverless Azure
PDF
Joe Emison - 10X Product Development
Generic Parse Server
Parse Server Open Source
Introduction Node.js
Inside Logic Apps
Serverless Architecture - Azure Logic apps
Tomasz Janczuk - Webtaskalifragilistexpialidocious
Anatomy of a Modern Node.js Application Architecture
Introduction to Node.js
Serverless Azure
Joe Emison - 10X Product Development
Ad

Similar to Parse introduction (17)

PDF
5分でわかったつもりになるParse.com
PDF
Parseでちゃんとアプリを作るコツ
PDF
Parse触ってみた
PDF
T4使ってみた
PPTX
Facebook Parseの世界
PDF
24時間でiOSアプリ-Twitterクライアント-の作成にチャレンジ ver1.1
PDF
iPhone, iPad アプリ開発勉強会#3
PDF
Saitama beginner tips50
KEY
軽量EvernoteクライアントSmartEverにおけるアプリ高速化の工夫と課題
PDF
I phoneアプリ入門 第5回
PDF
Introduction to cocoa sql mapper
PDF
IOS/Androidアプリの3つの大事な設計方針
PDF
探検!SwiftyJSON
PPTX
Deep dive into oss written in swift
PPTX
Deep dive into oss written in swift
PPTX
Androidで使えるJSON-Javaライブラリ
PPTX
日記アプリのデータ管理
5分でわかったつもりになるParse.com
Parseでちゃんとアプリを作るコツ
Parse触ってみた
T4使ってみた
Facebook Parseの世界
24時間でiOSアプリ-Twitterクライアント-の作成にチャレンジ ver1.1
iPhone, iPad アプリ開発勉強会#3
Saitama beginner tips50
軽量EvernoteクライアントSmartEverにおけるアプリ高速化の工夫と課題
I phoneアプリ入門 第5回
Introduction to cocoa sql mapper
IOS/Androidアプリの3つの大事な設計方針
探検!SwiftyJSON
Deep dive into oss written in swift
Deep dive into oss written in swift
Androidで使えるJSON-Javaライブラリ
日記アプリのデータ管理

Parse introduction

  • 1. 初めての Parse 株式会社 ミクシィ 田村 航弥 12年7月23日月曜日
  • 2. agenda • @tamotamago • what’s Parse? • Data Store • Query • Push Notification 12年7月23日月曜日
  • 4. @tamotamago について • 田村 航弥 • 東京 2 年目 iOS App developer • mixi for iPhone, iPad 開発 • http://alpha.mixi.co.jp/2012/10974/ • tamotamago.com 12年7月23日月曜日
  • 5. @tamotamago について • 第2回 iphone_dev_jp 東京iPhone/Mac勉強会 @k_kinukawa mixi の iOS アプリ開発 http://alpha.mixi.co.jp/2012/11000/ 12年7月23日月曜日
  • 7. What’s Parse • Parse は BaaS (Backend as a Service) 12年7月23日月曜日
  • 8. What’s Parse • Parse の機能 • ユーザ認証機能 • データストア、検索 • remote notification • twitter, facebok SDK をラップ • and so on ... 12年7月23日月曜日
  • 10. Parse の導入 • Parse Quick Start • tamotamago.com [Objective-C][Parse]初めての Parse ー導入編ー 12年7月23日月曜日
  • 11. Data Store https://parse.com/docs/ios/api/Classes/PFObject.html 12年7月23日月曜日
  • 12. Data Store • Key Value Store • ブラウザからデータ閲覧、編集が可能 • リレーションも持たせることができる 12年7月23日月曜日
  • 14. Data Store テーブル名みたいなもの かってにつくられる 自分でつくっていく 12年7月23日月曜日
  • 15. Save -blocks- PFObject *object = [[PFObject alloc]initWithClassName:@"TestClass"]; [object setObject:@"tamotamago" forKey:@"name"]; [object saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { NSString *result = succeeded ? @"success" : @"error"; NSLog(@"result : %@", result); }]; 12年7月23日月曜日
  • 16. Save -callbacks- - (void)viewDidLoad { [super viewDidLoad]; ! // Do any additional setup after loading the view, typically from a nib. PFObject *object = [[PFObject alloc]initWithClassName:@"TestClass"]; [object setObject:@"tamotamago2" forKey:@"name"]; [object saveInBackgroundWithTarget:self selector:@selector(saveCallback:error:)]; } -(void)saveCallback:(NSNumber*)result error:(NSError*)error { if(!error){ NSLog(@"%@", result); }else{ NSLog(@"%@", error); } } 12年7月23日月曜日
  • 17. Update PFObject *object = [[PFObject alloc]initWithClassName:@"TestClass"]; [object setObject:@"tamotamago3" forKey:@"name"]; [object saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { [object setObject:@"tamotamago4" forKey:@"name"]; [object save]; }]; PFObject が 1 タプル 12年7月23日月曜日
  • 18. Array Data PFObject *object = [[PFObject alloc]initWithClassName:@"TestClass"]; NSArray *names = [NSArray arrayWithObjects:@"tamotamago5", @"tamotamago6", nil]; [object addUniqueObjectsFromArray:names forKey:@"names"]; [object save]; 12年7月23日月曜日
  • 19. Relation -one-to-many- Post parent Comment Comment Comment 12年7月23日月曜日
  • 20. Relation -one-to-many- PFObject *myPost = [PFObject objectWithClassName:@"Post"]; [myPost setObject:@"I'm Hungry" forKey:@"title"]; [myPost setObject:@"Where should we go for lunch?" forKey:@"content"]; // Create the comment PFObject *myComment = [PFObject objectWithClassName:@"Comment"]; [myComment setObject:@"Let's do Sushirrito." forKey:@"content"]; // Add a relation between the Post and Comment [myComment setObject:myPost forKey:@"parent"]; // This will save both myPost and myComment [myComment saveInBackground]; 12年7月23日月曜日
  • 21. Relation -one-to-many- PFObject *myPost = [PFObject objectWithClassName:@"Post"]; [myPost setObject:@"I'm Hungry" forKey:@"title"]; [myPost setObject:@"Where should we go for lunch?" forKey:@"content"]; // Create the comment PFObject *myComment = [PFObject objectWithClassName:@"Comment"]; [myComment setObject:@"Let's do Sushirrito." forKey:@"content"]; // Add a relation between the Post and Comment [myComment setObject:myPost forKey:@"parent"]; // This will save both myPost and myComment [myComment saveInBackground]; 12年7月23日月曜日
  • 22. Relation -many-to-many- Post Post Post like user user user 12年7月23日月曜日
  • 23. Relation -many-to-many- Parse blog : A More Scalable Many-to-Many Approach PFObject *post2 = [PFObject objectWithClassName:@"Post"]; [post2 setObject:@"I'm Hungry" forKey:@"title"]; [post2 setObject:@"Where should we go for dinner?" forKey:@"content"]; PFRelation *relation = [post2 relationforKey:@"likes"]; for (PFObject *object in objects){ [relation addObject: object]; } [post2 save]; 12年7月23日月曜日
  • 24. Relation -many-to-many- Parse blog : A More Scalable Many-to-Many Approach PFObject *post2 = [PFObject objectWithClassName:@"Post"]; [post2 setObject:@"I'm Hungry" forKey:@"title"]; [post2 setObject:@"Where should we go for dinner?" forKey:@"content"]; PFRelation *relation = [post2 relationforKey:@"likes"]; for (PFObject *object in objects){ [relation addObject: object]; } [post2 save]; 12年7月23日月曜日
  • 25. Relation -many-to-many- Parse blog : A More Scalable Many-to-Many Approach PFObject *post2 = [PFObject objectWithClassName:@"Post"]; [post2 setObject:@"I'm Hungry" forKey:@"title"]; [post2 setObject:@"Where should we go for dinner?" forKey:@"content"]; PFRelation *relation = [post2 relationforKey:@"likes"]; for (PFObject *object in objects){ [relation addObject: object]; } [post2 save]; 12年7月23日月曜日
  • 26. Queries https://parse.com/docs/ios/api/Classes/PFQuery.html 12年7月23日月曜日
  • 28. Basic Query PFQuery *query = [PFQuery queryWithClassName:@"TestClass"]; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (!error) { // The find succeeded. for (PFObject *object in objects){ NSLog(@"object name -> %@", [object objectForKey:@"name"]); } } else { // Log details of the failure NSLog(@"Error: %@ %@", error, [error userInfo]); } }]; 2012-07-20 13:14:29.786 ParseTest[948:f803] object name -> tamotamago 2012-07-20 13:14:29.787 ParseTest[948:f803] object name -> tamotamago2 2012-07-20 13:14:29.787 ParseTest[948:f803] object name -> tamotamago4 2012-07-20 13:14:29.788 ParseTest[948:f803] object name -> (null) 2012-07-20 13:14:29.788 ParseTest[948:f803] object name -> tamotamago7 12年7月23日月曜日
  • 29. Basic Query PFQuery *query = [PFQuery queryWithClassName:@"TestClass"]; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (!error) { // The find succeeded. for (PFObject *object in objects){ NSLog(@"object name -> %@", [object objectForKey:@"name"]); } } else { // Log details of the failure NSLog(@"Error: %@ %@", error, [error userInfo]); } }]; 2012-07-20 13:14:29.786 ParseTest[948:f803] object name -> tamotamago 2012-07-20 13:14:29.787 ParseTest[948:f803] object name -> tamotamago2 2012-07-20 13:14:29.787 ParseTest[948:f803] object name -> tamotamago4 2012-07-20 13:14:29.788 ParseTest[948:f803] object name -> (null) 2012-07-20 13:14:29.788 ParseTest[948:f803] object name -> tamotamago7 12年7月23日月曜日
  • 30. Where 句 [query whereKey:@"name" equalTo:@"tamotamago"]; 12年7月23日月曜日
  • 31. OrderBy [query orderByAscending:@"name"]; 12年7月23日月曜日
  • 32. IN 句 NSArray *array = [NSArray arrayWithObjects: @"tamotamago", @"tamotamago2", nil]; [query whereKey:@"name" containedIn:array]; 12年7月23日月曜日
  • 34. Relation query PFQuery *query = [[PFQuery alloc] initWithClassName:@"Post"]; [query findObjectsInBackgroundWithBlock:^(NSArray *posts, NSError *error) { for (PFObject *post in posts){ PFRelation *relation = [post relationforKey:@"likes"]; PFQuery *relationQuery = [relation query]; [relationQuery findObjectsInBackgroundWithBlock:^(NSArray *tamotamagos, NSError *error) { for(PFObject *object in tamotamagos){ NSLog(@"%@", [object objectForKey:@"name"]); } }]; } }]; 12年7月23日月曜日
  • 35. Paging query.skip = 3; [query findObjects]; [query findObjects]; object name -> tamotamago object name -> tamotamago2 object name -> (null) object name -> tamotamago4 object name -> tamotamago7 object name -> (null) object name -> tamotamago7 12年7月23日月曜日
  • 36. Push Notification https://parse.com/docs/ios/api/Classes/PFPush.html 12年7月23日月曜日
  • 37. Setup https://www.parse.com/tutorials/ios-push-notifications 証明書の発行とか 12年7月23日月曜日
  • 39. Setup - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions { // Override point for customization after application launch. [Parse setApplicationId:@"app id" clientKey:@"client key"]; [application registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge| UIRemoteNotificationTypeAlert| UIRemoteNotificationTypeSound]; return YES; } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken { // Tell Parse about the device token. [PFPush storeDeviceToken:newDeviceToken]; // Subscribe to the global broadcast channel. [PFPush subscribeToChannelInBackground:@""]; } 12年7月23日月曜日
  • 41. channel Push を投げるゾーン 12年7月23日月曜日
  • 42. channel - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken { // Tell Parse about the device token. [PFPush storeDeviceToken:newDeviceToken]; // Subscribe to the global broadcast channel. [PFPush subscribeToChannelInBackground:@""]; [PFPush subscribeToChannelInBackground:@"tamotamago"]; } 12年7月23日月曜日
  • 43. channel tamotamago Broadcast 12年7月23日月曜日
  • 45. channel tamotamago3 tamotamago2 tamotamago Broadcast 12年7月23日月曜日
  • 46. send notification PFPush *push = [[PFPush alloc] init]; NSArray *channels = [NSArray arrayWithObjects:@"tamotamago", nil]; [push setChannels:channels]; [push setMessage:@"push test"]; [push sendPushInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { }]; 12年7月23日月曜日
  • 47. channel push!! tamotamago3 tamotamago2 tamotamago Broadcast 12年7月23日月曜日
  • 49. Others • Users • https://parse.com/docs/ios/api/Classes/PFUser.html • Geo Points • https://parse.com/docs/ios/api/Classes/PFGeoPoint.html • Facebook Users • https://parse.com/docs/ios/api/Classes/PFFacebookUtils.html • and so on ... 12年7月23日月曜日