iphone course 3

33
iPhone Application Development III Janet Huang 2011/12/07

Upload: janet-huang

Post on 18-Jun-2015

590 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Iphone course 3

iPhone Application Development IIIJanet Huang2011/12/07

Page 2: Iphone course 3

Today’s topic

• iOS programming review

• Facebook API

• Location + Facebook App

Page 3: Iphone course 3

overview of iPhone application

Page 4: Iphone course 3
Page 5: Iphone course 3
Page 6: Iphone course 3
Page 7: Iphone course 3
Page 8: Iphone course 3

 Key objects in an iOS app

Page 9: Iphone course 3
Page 10: Iphone course 3

View Controller

Page 11: Iphone course 3

View Controller

• Important property in UIViewController

• View Controller have a “lifecycle” from creation to destruction

@property (retain) UIView *view;

a pointer to top-level UIView in the Controller’s View

- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)aBundle;

initializer

Page 12: Iphone course 3

View Controller

• After the UIViewController is initialized, viewDidLoad is called

• Just before the view appears on screen, you get notified

- (void)viewDidLoad;

- (void)viewWillAppear:(BOOL)animated;

Page 13: Iphone course 3

View Controller

• Creating a UIViewController’s UI in code (no .xib, no storyboard)

• override - (void)loadView;

• set self.view

*Do NOT implement loadView if you use a storyboard/.xib to create the UIViewController. *Do NOT set self.view anywhere else besides in loadView. *Do NOT implement loadView without setting self.view (i.e. you must set self.view in loadView).

Page 14: Iphone course 3

Segues a pointer to top-level UIView in the Controller’s View

Page 15: Iphone course 3

Review

- Objective-C - Class, Methods, Properties, Protocols, Delegation

- MVC and UIViewController - MVC design - View Controller

- Interface Builder or Storyboard

- Delegation & Target-action

- Application Lifecycle

Page 16: Iphone course 3

MVC

controller

model view

outlet

target

delegate

data sources

shoulddid

will

count

data

action

Notification & KVO

Page 17: Iphone course 3

General process for building iPhone application

1.  Create  a  simple  MVC  iPhone  applica5on2.  Build  interfaces  using  Interface  builder3.  Declara5ons

a.  Declaring  instance  variablesb.  Declaring  methods

4.  Make  connec5onsa.  SeDng  a  pointerb.  SeDng  targets  and  ac5ons

5.  Implemen5ng  methodsa.  Ini5al  methodb.  Ac5on  methods

6.  Build  and  run  on  the  simulator7.  Test  applica5on  on  the  device

Page 18: Iphone course 3

Facebook API

Page 19: Iphone course 3

FB iOS SDK• Methods

• Authentication

• Dialog

• Request

• Protocols

• FBDialogDelegate

• FBRequestDelegate

• FBSessionDelegate

Page 20: Iphone course 3
Page 21: Iphone course 3
Page 22: Iphone course 3
Page 23: Iphone course 3

SearchBookmark

Page 24: Iphone course 3

https://developers.facebook.com/docs/guides/mobile/

Create a FB iOS App

Page 25: Iphone course 3

https://developers.facebook.com/apps/

Step1: Registering your iOS App with Facebook

Step 2: Installing the iOS SDK

git clone git://github.com/facebook/facebook-ios-sdk.git

https://github.com/facebook/facebook-ios-sdk

use git cloneOR download it directly

Step 3: Implementing Single Sign-On (SSO)*access_token

Page 26: Iphone course 3

Step 1:

Step 2:

Step 3:

Step 4:

Page 27: Iphone course 3

Step 5:

Step 6:

Page 28: Iphone course 3

modify the app property list file

Page 29: Iphone course 3

Test it!! :D

Page 30: Iphone course 3

Add Requesting Additional Permissions

Page 31: Iphone course 3

Add Graph API

Page 32: Iphone course 3

Add Social Channel

Request

News Feed

Page 33: Iphone course 3

Implementation & Integration