Download - Iphone course 3
![Page 1: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/1.jpg)
iPhone Application Development IIIJanet Huang2011/12/07
![Page 2: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/2.jpg)
Today’s topic
• iOS programming review
• Facebook API
• Location + Facebook App
![Page 3: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/3.jpg)
overview of iPhone application
![Page 4: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/4.jpg)
![Page 5: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/5.jpg)
![Page 6: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/6.jpg)
![Page 7: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/7.jpg)
![Page 8: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/8.jpg)
Key objects in an iOS app
![Page 9: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/9.jpg)
![Page 10: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/10.jpg)
View Controller
![Page 11: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/11.jpg)
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](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/12.jpg)
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](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/13.jpg)
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](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/14.jpg)
Segues a pointer to top-level UIView in the Controller’s View
![Page 15: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/15.jpg)
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](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/16.jpg)
MVC
controller
model view
outlet
target
delegate
data sources
shoulddid
will
count
data
action
Notification & KVO
![Page 17: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/17.jpg)
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](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/18.jpg)
Facebook API
![Page 19: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/19.jpg)
FB iOS SDK• Methods
• Authentication
• Dialog
• Request
• Protocols
• FBDialogDelegate
• FBRequestDelegate
• FBSessionDelegate
![Page 20: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/20.jpg)
![Page 21: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/21.jpg)
![Page 22: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/22.jpg)
![Page 23: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/23.jpg)
SearchBookmark
![Page 24: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/24.jpg)
https://developers.facebook.com/docs/guides/mobile/
Create a FB iOS App
![Page 25: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/25.jpg)
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](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/26.jpg)
Step 1:
Step 2:
Step 3:
Step 4:
![Page 27: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/27.jpg)
Step 5:
Step 6:
![Page 28: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/28.jpg)
modify the app property list file
![Page 29: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/29.jpg)
Test it!! :D
![Page 30: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/30.jpg)
Add Requesting Additional Permissions
![Page 31: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/31.jpg)
Add Graph API
![Page 32: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/32.jpg)
Add Social Channel
Request
News Feed
![Page 33: Iphone course 3](https://reader033.vdocuments.net/reader033/viewer/2022060116/55820fb8d8b42ac7728b4680/html5/thumbnails/33.jpg)
Implementation & Integration