ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
iPhone Developer Advance Program




                              by Eakapong Kattiya
Monday, October 25, 2010
????????????????????????

                 - Objective-C for iPhone Programming

                 - Basic UI iPhone Programming

                 - Model View Controller

                 - XML / JSON




Monday, October 25, 2010
FaceBook
           ?????????? iphone application ????????????????????? ??????
           ???? Wall ???????????????? Facebook iPhone SDK ???????????
           ???

             1. ????? Facebook Account
                www.facebook.com

             2. ????? Facebook Application
                http://www.facebook.com/developers/createapp.php

             3. Download facebook iphone sdk
                http://github.com/facebook/facebook-ios-sdk




Monday, October 25, 2010
Import FaceBook to project
           ??????????? download at?http://github.com/facebook/facebook-
           iphone-sdk/???? uncompress ????????????????? ?????????? link ????
           ??????? project ????????????

             1. ???????????????????????????????? ???????????
                ?????FBConnect.xcodeproj ?????????????????????? src ??????????
                ??? download ??
             2. ??? group ??????? FBConnect ????????? project ?????? download
                ????????????????????????
             3. click ???????????????????????????? Get Info, ?? tab Build ???
                ?????????????? User Header Search Paths ???? path
                ???????? directory ??????? FBConnect.xcodeproj ??????????
                ????? 1 ??????????????????




Monday, October 25, 2010
How to post to Facebook¡¯s wall

             1. ????? facebook session
             2. login ???? facebook
             3. ?????????????????????? grant permission ????????????????
                ?????????????? timeline ???
             4. ??????????? dialog ??? api ????????????




Monday, October 25, 2010
1. ????? Facebook Session


           #import "FBConnect/FBConnect.h"

           ???????????? session ???? factory method ??? FBSession
           ?????? KEY ?????? http://www.facebook.com/developers/
           apps.php ??????????? session ?????????????????????
           facebook ?????? ??????

            if(![_session resume]){
             _session = [FBSession?
           ?? ? ? ? ? ? ? ? ? ?sessionForApplication: API_KEY secret:
           SECRET_KEY delegate:self];
            }




Monday, October 25, 2010
2. login ???? facebook

         ?????????????? login ???? facebook ?????? view ??????????????????
         ?????????????? login ?????????? facebook

          FBLoginButton* button = [[[FBLoginButton alloc] init] autorelease];
          [view?addSubview:button];

         ??????? login ????????? delegate method ?????????????
         FBDialogDelegate ??????????????

          - (void)session:(FBSession*)session didLogin:(FBUID)uid {

          }




Monday, October 25, 2010
3. Grant permission

           ??????? login ???? ????? Grant permission ???????????
           ??????????????????????? timeline ??? ???????????
           dialog ???????????????????????????

            FBPermissionDialog* dialog = [[[FBPermissionDialog alloc]
           init] autorelease];

            dialog.delegate = self;
            dialog.permission = @"status_update";
            [dialog show];




Monday, October 25, 2010
3. Grant permission (???)

           ???? dialog ?????????????????????????????????? application ???
           ????????????????????????????????????????? timeline ??????
           ?????????????

           ?????? dialog ????????????????? event ???? 2 ?????? ???? ???
           ?????? ????????? event ??????? call delegate 2 ??????

            - (void)dialogDidSucceed:(FBDialog*)dialog {

            }
               ???
            - (void)dialogDidCancel:(FBDialog*)dialog {

            }




Monday, October 25, 2010
4. Post to wall

           ??????????? permission ???????????????????????????
           timeline ???? ???????????????????????????
           FBStreamDialog ??????????? ??????

            FBStreamDialog *streamDialog = [[[FBStreamDialog alloc]
           init] autorelease];
            streamDialog.delegate = self;
            streamDialog.userMessagePrompt = @"Dialog Prompt";
            streamDialog.attachment = attachment;
            [streamDialog show];




Monday, October 25, 2010
4. Post to wall

            property ???? attachment ??? FBStreamDialog ??????????????? content ???????????????? wall ???? JSON
            format ?????????http://wiki.developers.facebook.com/index.php/Attachment_(Streams)
            ???????????????? attatchment ??????????


              NSString *attachment = @"{"name":"Facebook iPhone SDK","
              ""href":"http://developers.facebook.com/connect.php?tab=iphone","
              ""caption":"Caption","
              ""description":"Description","
              ""media":[{"type":"image","
              ""src":"http://www.dhammapost.com/netdesign/basic/icon.png","
              ""href":"http://developers.facebook.com/connect.php?tab=iphone/"}],"
              ""properties":{"another link":{"text":"Facebook home page","
              ""href":"http://www.facebook.com"}}}";




Monday, October 25, 2010
4. Post to wall

           ???????? dialog ???????????????????????????????? dialog show
           ???????????????????????????????????




Monday, October 25, 2010
5. Show Timeline




Monday, October 25, 2010

More Related Content

iOS Advance Development - Social Media

  • 1. iPhone Developer Advance Program by Eakapong Kattiya Monday, October 25, 2010
  • 2. ???????????????????????? - Objective-C for iPhone Programming - Basic UI iPhone Programming - Model View Controller - XML / JSON Monday, October 25, 2010
  • 3. FaceBook ?????????? iphone application ????????????????????? ?????? ???? Wall ???????????????? Facebook iPhone SDK ??????????? ??? 1. ????? Facebook Account www.facebook.com 2. ????? Facebook Application http://www.facebook.com/developers/createapp.php 3. Download facebook iphone sdk http://github.com/facebook/facebook-ios-sdk Monday, October 25, 2010
  • 4. Import FaceBook to project ??????????? download at?http://github.com/facebook/facebook- iphone-sdk/???? uncompress ????????????????? ?????????? link ???? ??????? project ???????????? 1. ???????????????????????????????? ??????????? ?????FBConnect.xcodeproj ?????????????????????? src ?????????? ??? download ?? 2. ??? group ??????? FBConnect ????????? project ?????? download ???????????????????????? 3. click ???????????????????????????? Get Info, ?? tab Build ??? ?????????????? User Header Search Paths ???? path ???????? directory ??????? FBConnect.xcodeproj ?????????? ????? 1 ?????????????????? Monday, October 25, 2010
  • 5. How to post to Facebook¡¯s wall 1. ????? facebook session 2. login ???? facebook 3. ?????????????????????? grant permission ???????????????? ?????????????? timeline ??? 4. ??????????? dialog ??? api ???????????? Monday, October 25, 2010
  • 6. 1. ????? Facebook Session #import "FBConnect/FBConnect.h" ???????????? session ???? factory method ??? FBSession ?????? KEY ?????? http://www.facebook.com/developers/ apps.php ??????????? session ????????????????????? facebook ?????? ?????? if(![_session resume]){ _session = [FBSession? ?? ? ? ? ? ? ? ? ? ?sessionForApplication: API_KEY secret: SECRET_KEY delegate:self]; } Monday, October 25, 2010
  • 7. 2. login ???? facebook ?????????????? login ???? facebook ?????? view ?????????????????? ?????????????? login ?????????? facebook FBLoginButton* button = [[[FBLoginButton alloc] init] autorelease]; [view?addSubview:button]; ??????? login ????????? delegate method ????????????? FBDialogDelegate ?????????????? - (void)session:(FBSession*)session didLogin:(FBUID)uid { } Monday, October 25, 2010
  • 8. 3. Grant permission ??????? login ???? ????? Grant permission ??????????? ??????????????????????? timeline ??? ??????????? dialog ??????????????????????????? FBPermissionDialog* dialog = [[[FBPermissionDialog alloc] init] autorelease]; dialog.delegate = self; dialog.permission = @"status_update"; [dialog show]; Monday, October 25, 2010
  • 9. 3. Grant permission (???) ???? dialog ?????????????????????????????????? application ??? ????????????????????????????????????????? timeline ?????? ????????????? ?????? dialog ????????????????? event ???? 2 ?????? ???? ??? ?????? ????????? event ??????? call delegate 2 ?????? - (void)dialogDidSucceed:(FBDialog*)dialog { } ??? - (void)dialogDidCancel:(FBDialog*)dialog { } Monday, October 25, 2010
  • 10. 4. Post to wall ??????????? permission ??????????????????????????? timeline ???? ??????????????????????????? FBStreamDialog ??????????? ?????? FBStreamDialog *streamDialog = [[[FBStreamDialog alloc] init] autorelease]; streamDialog.delegate = self; streamDialog.userMessagePrompt = @"Dialog Prompt"; streamDialog.attachment = attachment; [streamDialog show]; Monday, October 25, 2010
  • 11. 4. Post to wall property ???? attachment ??? FBStreamDialog ??????????????? content ???????????????? wall ???? JSON format ?????????http://wiki.developers.facebook.com/index.php/Attachment_(Streams) ???????????????? attatchment ?????????? NSString *attachment = @"{"name":"Facebook iPhone SDK"," ""href":"http://developers.facebook.com/connect.php?tab=iphone"," ""caption":"Caption"," ""description":"Description"," ""media":[{"type":"image"," ""src":"http://www.dhammapost.com/netdesign/basic/icon.png"," ""href":"http://developers.facebook.com/connect.php?tab=iphone/"}]," ""properties":{"another link":{"text":"Facebook home page"," ""href":"http://www.facebook.com"}}}"; Monday, October 25, 2010
  • 12. 4. Post to wall ???????? dialog ???????????????????????????????? dialog show ??????????????????????????????????? Monday, October 25, 2010
  • 13. 5. Show Timeline Monday, October 25, 2010