Skip to content
Browse files

first commit

  • Loading branch information...
0 parents commit 8a1b923b39be8215857dd2b74e48e77a9e54bbaa Yujuan Bao committed Jun 25, 2010
Showing with 5,661 additions and 0 deletions.
  1. +129 −0 README.mdown
  2. +29 −0 sample/DemoApp/Classes/DemoAppAppDelegate.h
  3. +45 −0 sample/DemoApp/Classes/DemoAppAppDelegate.m
  4. +46 −0 sample/DemoApp/Classes/DemoAppViewController.h
  5. +225 −0 sample/DemoApp/Classes/DemoAppViewController.m
  6. +650 −0 sample/DemoApp/Classes/DemoAppViewController.xib
  7. +31 −0 sample/DemoApp/Classes/FBLoginButton.h
  8. +69 −0 sample/DemoApp/Classes/FBLoginButton.m
  9. +30 −0 sample/DemoApp/DemoApp-Info.plist
  10. +342 −0 sample/DemoApp/DemoApp.xcodeproj/project.pbxproj
  11. +8 −0 sample/DemoApp/DemoApp_Prefix.pch
  12. +198 −0 sample/DemoApp/MainWindow.xib
  13. +26 −0 sample/DemoApp/main.m
  14. BIN sample/FBConnect.bundle/images/login.png
  15. BIN sample/FBConnect.bundle/images/login_down.png
  16. BIN sample/FBConnect.bundle/images/logout.png
  17. BIN sample/FBConnect.bundle/images/logout_down.png
  18. +22 −0 src/FBConnect.h
  19. +148 −0 src/FBDialog.h
  20. +640 −0 src/FBDialog.m
  21. +46 −0 src/FBLoginDialog.h
  22. +104 −0 src/FBLoginDialog.m
  23. +106 −0 src/FBRequest.h
  24. +275 −0 src/FBRequest.m
  25. +97 −0 src/Facebook.h
  26. +412 −0 src/Facebook.m
  27. +50 −0 src/JSON/JSON.h
  28. +68 −0 src/JSON/NSObject+SBJSON.h
  29. +53 −0 src/JSON/NSObject+SBJSON.m
  30. +58 −0 src/JSON/NSString+SBJSON.h
  31. +55 −0 src/JSON/NSString+SBJSON.m
  32. +75 −0 src/JSON/SBJSON.h
  33. +212 −0 src/JSON/SBJSON.m
  34. +86 −0 src/JSON/SBJsonBase.h
  35. +78 −0 src/JSON/SBJsonBase.m
  36. +87 −0 src/JSON/SBJsonParser.h
  37. +475 −0 src/JSON/SBJsonParser.m
  38. +129 −0 src/JSON/SBJsonWriter.h
  39. +237 −0 src/JSON/SBJsonWriter.m
  40. +313 −0 src/facebook-ios-sdk.xcodeproj/project.pbxproj
  41. +7 −0 src/facebook_ios_sdk_Prefix.pch
129 README.mdown
@@ -0,0 +1,129 @@
+Facebook Connect for iPhone
+===========================
+
+This open source iPhone library allows you to integrate Facebook into your iPhone application.
+
+Except as otherwise noted, the Facebook Connect iPhone SDK is licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+
+Alpha Status
+------------
+
+This is an alpha release. In order to guide the development of the library and allow you to freely inspect and use the source, we have open-sourced the library. The underlying APIs are generally stable, however we may make changes to the library in response to developer feedback.
+
+Known Issues
+------------
+
+* Binary API parameters (such as uploading pictures) is not yet supported -- coming soon, but if you have already implemented it, feel free to send us a patch!
+
+* The dialog webviews may be blank if an error occurs -- we are working on figuring these out and providing more debugging information. Sorry for the frustration.
+
+* If you see "an invalid next or cancel parameter was specified" message in the login dialog, then you need to migrate your application to the New Data Permissions. This can be done by going to http://www.facebook.com/developers/apps.php then selecting the application you are testing with, and clicking "Edit Settings" (the third item underneath Total Users). On the settings page, click on Migrations (bottom of the left menu), then set New Data Permissions to "Enabled"
+
+Getting Started
+===============
+
+The SDK is lightweight and has no external dependencies. Getting started is quick and easy.
+
+Install necessary packages
+--------------------------
+
+* Follow the (https://developer.apple.com/iphone/index.action)[iPhone Dev Center Getting Started Documents].
+
+* Pull the read-only repository from github.
+
+ git clone git://github.com/facebook/facebook-iphone-sdk-2.0.git
+ (if you have trouble, you could also try "git clone http://github.com/facebook/facebook-iphone-sdk-2.0.git")
+
+Create your own application
+---------------------------
+
+* Create a Facebook Application: http://www.facebook.com/developers/createapp.php
+
+* Check out the mobile documentation: http://developers.facebook.com/docs/guides/mobile/
+
+* Adding Connect to your Xcode project
+ * Open the src/FBConnect.xcodeproj project file.
+ * Drag the "FBConnect" group into your application's Xcode project.
+ * Make sure that the FBConnect headers are in the include path. Go into your project's settings and enter the relative or absolute path to the "src" directory.
+ * Include the FBConnect headers in your code:
+ #import "FBConnect/FBConnect.h"
+ * You should now be able to compile your project successfully.
+
+Usage
+-----
+
+With the iPhone SDK, you can do three main things:
+
+* Authorize users: prompt users to log in to facebook and grant access permission to your application.
+
+User credentials are not handled by the iPhone application in this SDK: authentication is done in an embedded webView using the OAuth 2.0 User-Agent flow to obtain an access token.
+
+* Make API requests
+
+Requests to the Facebook Graph and REST APIs are supported in this SDK. Authenticated requests are done over https using the OAuth access token.
+
+* Display a Facebook dialog
+
+The SDK supports several WebView html dialogs for user interactions, such as creating a wall post. This is intended to provided quick Facebook functionality without having to implement a native iPhone UI and pass data to facebook directly though the APIs.
+
+Authentication and Authorization
+--------------------------------
+
+User login and application permission requests use the same method: authorize(). By default, if you pass an empty ''permissions'' parameter, then you will get access to the user's basic information., which includes their name, profile picture, list of friends and other general information. For more information, see http://developers.facebook.com/docs/authentication/.
+
+If you pass in extra permissions in the permissions parameter (e.g. "publish_stream", "offline_access"), then the user will be prompted to grant these permissions. "offline_access" is particularly useful, as it avoids access expiration and ongoing prompts to the user for access. See http://developers.facebook.com/docs/authentication/permissions
+
+This SDK uses the (http://tools.ietf.org/html/draft-ietf-oauth-v2)["user-agent"] flow from OAuth 2.0 for authentication details.
+
+To authorize a user, the simplest usage is:
+
+ facebook = [[Facebook alloc] init];
+ [facebook authorize:apiKey permissions:permissions delegate:self];
+
+The authorize method generate a dialog with WebView content from Facebook, prompting the user to log in and grant access. The FBSessionDelegate is a callback interface that your application should implement: it's methods will be invoked when the application successful login or logout.
+
+See the sample applications for more specific code samples.
+
+When the user wants to stop using Facebook integration with your application, you can call the logout method to clear all application state and make a server request to invalidate the current OAuth 2.0 token.
+
+ [facebook logout:self]
+
+
+Accessing the Graph API
+-----------------------
+
+The (http://developers.facebook.com/docs/api)[Facebook Graph API] presents a simple, consistent view of the Facebook social graph, uniformly representing objects in the graph (e.g., people, photos, events, and fan pages) and the connections between them (e.g., friend relationships, shared content, and photo tags).
+
+You can access the Graph API by passing the Graph Path to the ''request'' method. For example, to access information about the logged in user, call
+
+ [facebook requestWithGraphPath:@"me" andDelegate:self]; // get information about the currently logged in user
+ [facebook requestWithGraphPath:@"platform/posts" andDelegate:self]; // get the posts made by the "platform" page
+ [facebook requestWithGraphPath:@"me/friends" andDelegate:self]; // get the logged-in user's friends
+
+The FBRequestDelegate is an interface that handle the request response that your application should implement.
+
+Note that the server response is in JSON string format. The SDK use a open source package json frame work (http://code.google.com/p/json-framework/) to parse the result. If there is error, it will call request:didFailWithError: function in the FBRequestDelegate. If it is succeed, it will call request:didLoad: function in the FBRequestDelegate. The result passed to the FBRequestDelegate can be an NSArray for multiple results or a NSDictionary for single result.
+i whose fields and values can be inspected and accessed. The sample implementation checks for a variety of error conditions and raises JSON or Facebook exceptions if the content is invalid or includes an error generated by the server. Advanced applications may wish to provide their own parsing and error handling.
+
+The (http://developers.facebook.com/docs/reference/rest/)[Old REST API] is also supported. To access the older methods, pass in the named parameters and method name as a NSDictionary.
+
+ NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"4", @"uids", @"name", @"fields", nil];
+ [facebook requestWithMethodName: @"users.getInfo" andParams: params andHttpMethod: @"GET" andDelegate: self];
+
+
+User Interface Dialogs
+----------------------
+
+This SDK provides a method for popping up a Facebook dialog. The currently supported dialogs are the login and permissions dialogs used in the authorization flow, and a "stream.publish" flow for making a wall post. The dialog require an action to perform, and a FBDialogDelegate interface for notification that must be implemented by the application. For example,
+
+ NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: apiKey, @"api_key", nil];
+
+ [facebook dialog: @"stream.publish" andParams: params andDelegate:self];
+
+This allows you to provide basic Facebook functionality in your application with a singe line of code -- no need to build native dialogs, make API calls, or handle responses.
+
+Error Handling
+--------------
+
+For Request and Dialog, errors are handled by FBRequestDelegate and FBDialogDelegate callback methods. Application can implement these interface to handle them.
+
29 sample/DemoApp/Classes/DemoAppAppDelegate.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2009-2010 Facebook
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#import <UIKit/UIKit.h>
+#import "DemoAppViewController.h"
+
+@interface DemoAppAppDelegate : NSObject <UIApplicationDelegate> {
+ UIWindow *window;
+ DemoAppViewController* controller;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+
+@end
+
45 sample/DemoApp/Classes/DemoAppAppDelegate.m
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2009-2010 Facebook
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#import "DemoAppAppDelegate.h"
+#import "DemoAppViewController.h"
+
+@implementation DemoAppAppDelegate
+
+@synthesize window;
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ // Override point for customization after application launch
+ controller = [[DemoAppViewController alloc] init];
+ controller.view.frame = CGRectMake(0, 20, 320, 460);
+ [window addSubview:controller.view];
+
+ [window makeKeyAndVisible];
+ return YES;
+
+}
+
+
+- (void)dealloc {
+ [window release];
+ [controller release];
+ [super dealloc];
+}
+
+
+@end
46 sample/DemoApp/Classes/DemoAppViewController.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2009-2010 Facebook
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#import <UIKit/UIKit.h>
+#import "FBConnect.h"
+#import "FBLoginButton.h"
+
+
+@interface DemoAppViewController : UIViewController
+<FBRequestDelegate,
+FBDialogDelegate,
+FBSessionDelegate>{
+ IBOutlet UILabel* _label;
+ IBOutlet FBLoginButton* _fbButton;
+ IBOutlet UIButton* _getUserInfoButton;
+ IBOutlet UIButton* _getUserInfoButton2;
+ IBOutlet UIButton* _publishButton;
+ Facebook* _facebook;
+ NSArray* _permissions;
+}
+
+@property(nonatomic, retain) UILabel* label;
+
+-(IBAction) fbButtonClick: (id) sender;
+
+-(IBAction) getUserInfo: (id) sender;
+
+-(IBAction) getUserInfo2: (id)sender;
+
+-(IBAction) publishStream: (id) sender;
+
+@end
225 sample/DemoApp/Classes/DemoAppViewController.m
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2009-2010 Facebook
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#import "DemoAppViewController.h"
+#import "FBConnect.h"
+
+static NSString* kApiKey = @"39c66d68e4adfa4691c4b93cf0afa93d";
+
+@implementation DemoAppViewController
+
+@synthesize label = _label;
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+// UIViewController
+
+/**
+ * initialization
+ */
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
+ if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
+ _permissions = [[NSArray arrayWithObjects:
+ @"publish_stream",@"read_stream", @"offline_access",nil] retain];
+ }
+
+ return self;
+}
+
+/**
+ * Set initial view
+ */
+- (void) viewDidLoad {
+ _facebook = [[[[Facebook alloc] init] autorelease] retain];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ [self.label setText:@"Please log in"];
+ _getUserInfoButton.hidden = YES;
+ _getUserInfoButton2.hidden = YES;
+ _publishButton.hidden = YES;
+ _fbButton.isLoggedIn = NO;
+ [_fbButton updateImage];
+
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// NSObject
+
+- (void) dealloc {
+ [_label release];
+ [_fbButton release];
+ [_getUserInfoButton release];
+ [_getUserInfoButton2 release];
+ [_publishButton release];
+ [_facebook release];
+ [_permissions release];
+ [super dealloc];
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// private
+
+/**
+ * Example of facebook login and permission request
+ */
+- (void) login {
+ [_facebook authorize:kApiKey permissions:_permissions delegate:self];
+}
+
+/**
+ * Example of facebook logout
+ */
+- (void) logout {
+ [_facebook logout:self];
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// IBAction
+
+/**
+ * Login/out button click
+ */
+- (IBAction) fbButtonClick: (id) sender {
+ if (_fbButton.isLoggedIn) {
+ [self logout];
+ } else {
+ [self login];
+ }
+}
+
+/**
+ * Example of graph API CAll
+ */
+- (IBAction) getUserInfo: (id)sender {
+ [_facebook requestWithGraphPath:@"me" andDelegate:self];
+}
+
+/**
+ * Example of REST API call
+ */
+- (IBAction) getUserInfo2: (id)sender {
+ NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ @"4", @"uids",
+ @"name", @"fields",
+ nil];
+ [_facebook requestWithMethodName: @"users.getInfo"
+ andParams: params
+ andHttpMethod: @"POST"
+ andDelegate: self];
+}
+
+/**
+ * Example of display UIServer dialog
+ */
+- (IBAction) publishStream: (id)sender {
+
+ SBJSON *jsonWriter = [[SBJSON new] autorelease];
+
+ NSDictionary* actionLinks = [NSDictionary dictionaryWithObjectsAndKeys:
+ @"Always Running",@"text",@"http://itsti.me/",@"href", nil];
+
+ NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
+ NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
+ @"a long run", @"name",
+ @"The Facebook Running app", @"caption",
+ @"it is fun", @"description",
+ @"http://itsti.me/", @"href", nil];
+ NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
+ NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ kApiKey, @"api_key",
+ @"Share on Facebook", @"user_message_prompt",
+ actionLinksStr, @"action_links",
+ attachmentStr, @"attachment",
+ nil];
+
+
+ [_facebook dialog: @"stream.publish"
+ andParams: params
+ andDelegate:self];
+
+}
+
+
+
+
+// Override to allow orientations other than the default portrait orientation.
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ return YES;
+}
+
+
+/**
+ * Callback for facebook login
+ */
+-(void) fbDidLogin {
+ [self.label setText:@"logged in"];
+ _getUserInfoButton.hidden = NO;
+ _getUserInfoButton2.hidden = NO;
+ _publishButton.hidden = NO;
+ _fbButton.isLoggedIn = YES;
+ [_fbButton updateImage];
+}
+
+/**
+ * Callback for facebook logout
+ */
+-(void) fbDidLogout {
+ [self.label setText:@"Please log in"];
+ _getUserInfoButton.hidden = YES;
+ _getUserInfoButton2.hidden = YES;
+ _publishButton.hidden = YES;
+ _fbButton.isLoggedIn = NO;
+ [_fbButton updateImage];
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// FBRequestDelegate
+
+/**
+ * Callback when a request receives Response
+ */
+- (void)request:(FBRequest*)request didReceiveResponse:(NSURLResponse*)response{
+ NSLog(@"received response");
+};
+
+/**
+ * Called when an error prevents the request from completing successfully.
+ */
+- (void)request:(FBRequest*)request didFailWithError:(NSError*)error{
+ [self.label setText:[error localizedDescription]];
+};
+
+/**
+ * Called when a request returns and its response has been parsed into an object.
+ * The resulting object may be a dictionary, an array, a string, or a number, depending
+ * on thee format of the API response.
+ */
+- (void)request:(FBRequest*)request didLoad:(id)result{
+ if ([result isKindOfClass:[NSArray class]]) {
+ result = [result objectAtIndex:0];
+ }
+ [self.label setText:[result objectForKey:@"name"]];
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// FBDialogDelegate
+
+/**
+ * Called when a UIServer Dialog successfully return
+ */
+- (void)dialogDidSucceed:(FBDialog*)dialog{
+ [self.label setText:@"publish successfully"];
+}
+
+@end
650 sample/DemoApp/Classes/DemoAppViewController.xib
@@ -0,0 +1,650 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">800</int>
+ <string key="IBDocument.SystemVersion">10D573</string>
+ <string key="IBDocument.InterfaceBuilderVersion">762</string>
+ <string key="IBDocument.AppKitVersion">1038.29</string>
+ <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">87</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="1"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIView" id="191373211">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUIButton" id="961192420">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{127, 68}, {72, 37}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <object class="NSFont" key="IBUIFont" id="915421114">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">15</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <int key="IBUIButtonType">1</int>
+ <object class="NSColor" key="IBUIHighlightedTitleColor" id="770377711">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleShadowColor" id="572866613">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ </object>
+ <object class="IBUILabel" id="180600138">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{31, 20}, {265, 40}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <int key="IBUIContentMode">7</int>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <string key="IBUIText">Label</string>
+ <object class="NSFont" key="IBUIFont">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">18</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDAAA</bytes>
+ </object>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">16</float>
+ <int key="IBUITextAlignment">1</int>
+ </object>
+ <object class="IBUIButton" id="809253328">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{98, 113}, {131, 37}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <reference key="IBUIFont" ref="915421114"/>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">Call Graph API</string>
+ <reference key="IBUIHighlightedTitleColor" ref="770377711"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="572866613"/>
+ </object>
+ <object class="IBUIButton" id="454090630">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{97, 208}, {132, 37}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <reference key="IBUIFont" ref="915421114"/>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">publish stream</string>
+ <reference key="IBUIHighlightedTitleColor" ref="770377711"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="572866613"/>
+ </object>
+ <object class="IBUIButton" id="677071957">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{100, 158}, {127, 37}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <reference key="IBUIFont" ref="915421114"/>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">Call REST API</string>
+ <reference key="IBUIHighlightedTitleColor" ref="770377711"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="572866613"/>
+ </object>
+ </object>
+ <string key="NSFrameSize">{320, 460}</string>
+ <reference key="NSSuperview"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="191373211"/>
+ </object>
+ <int key="connectionID">3</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">_label</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="180600138"/>
+ </object>
+ <int key="connectionID">8</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">_fbButton</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="961192420"/>
+ </object>
+ <int key="connectionID">9</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">_getUserInfoButton</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="809253328"/>
+ </object>
+ <int key="connectionID">10</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">_publishButton</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="454090630"/>
+ </object>
+ <int key="connectionID">11</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">getUserInfo:</string>
+ <reference key="source" ref="809253328"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">12</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">publishStream:</string>
+ <reference key="source" ref="454090630"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">13</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">fbButtonClick:</string>
+ <reference key="source" ref="961192420"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">14</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">getUserInfo2:</string>
+ <reference key="source" ref="677071957"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">17</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">_getUserInfoButton2</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="677071957"/>
+ </object>
+ <int key="connectionID">18</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="191373211"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="180600138"/>
+ <reference ref="961192420"/>
+ <reference ref="677071957"/>
+ <reference ref="809253328"/>
+ <reference ref="454090630"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">4</int>
+ <reference key="object" ref="961192420"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="180600138"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6</int>
+ <reference key="object" ref="809253328"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">7</int>
+ <reference key="object" ref="454090630"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">15</int>
+ <reference key="object" ref="677071957"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>1.IBEditorWindowLastContentRect</string>
+ <string>1.IBPluginDependency</string>
+ <string>15.IBPluginDependency</string>
+ <string>4.CustomClassName</string>
+ <string>4.IBPluginDependency</string>
+ <string>5.IBPluginDependency</string>
+ <string>6.IBPluginDependency</string>
+ <string>7.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>DemoAppViewController</string>
+ <string>UIResponder</string>
+ <string>{{642, 213}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>FBLoginButton</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">18</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">DemoAppViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>fbButtonClick:</string>
+ <string>getUserInfo2:</string>
+ <string>getUserInfo:</string>
+ <string>publishStream:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>_fbButton</string>
+ <string>_getUserInfoButton</string>
+ <string>_getUserInfoButton2</string>
+ <string>_label</string>
+ <string>_publishButton</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>FBLoginButton</string>
+ <string>UIButton</string>
+ <string>UIButton</string>
+ <string>UILabel</string>
+ <string>UIButton</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/DemoAppViewController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">FBLoginButton</string>
+ <string key="superclassName">UIButton</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/FBLoginButton.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">../../facebook-iphone-sdk/JSON/NSObject+SBJSON.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">../../facebook-iphone-sdk/JSON/SBJsonWriter.h</string>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSError.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSNetServices.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSPort.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSStream.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSXMLParser.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="499359301">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIButton</string>
+ <string key="superclassName">UIControl</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIButton.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIControl</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIControl.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UILabel</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UILabel.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIResponder</string>
+ <string key="superclassName">NSObject</string>
+ <reference key="sourceIdentifier" ref="499359301"/>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UISearchBar</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UISearchDisplayController</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIView</string>
+ <string key="superclassName">UIResponder</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <string key="superclassName">UIResponder</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3000" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../DemoApp.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">87</string>
+ </data>
+</archive>
31 sample/DemoApp/Classes/FBLoginButton.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2009 Facebook
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * Standard button which lets the user log in or out of the session.
+ *
+ * The button will automatically change to reflect the state of the session, showing
+ * "login" if the session is not connected, and "logout" if the session is connected.
+ */
+@interface FBLoginButton : UIButton {
+ BOOL _isLoggedIn;
+}
+
+@property(nonatomic) BOOL isLoggedIn;
+
+- (void) updateImage;
+
+@end
69 sample/DemoApp/Classes/FBLoginButton.m
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2009 Facebook
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#import "FBLoginButton.h"
+#import "Facebook.h"
+
+#import <dlfcn.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+@implementation FBLoginButton
+
+@synthesize isLoggedIn = _isLoggedIn;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// private
+
+/**
+ * return the regular button image according to the login status
+ */
+- (UIImage*)buttonImage {
+ if (_isLoggedIn) {
+ return [UIImage imageNamed:@"FBConnect.bundle/images/logout.png"];
+ } else {
+ return [UIImage imageNamed:@"FBConnect.bundle/images/login.png"];
+ }
+}
+
+/**
+ * return the highlighted button image according to the login status
+ */
+- (UIImage*)buttonHighlightedImage {
+ if (_isLoggedIn) {
+ return [UIImage imageNamed:@"FBConnect.bundle/images/logout_down.png"];
+ } else {
+ return [UIImage imageNamed:@"FBConnect.bundle/images/login_down.png"];
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+// public
+
+/**
+ * To be called whenever the login status is changed
+ */
+- (void)updateImage {
+ self.imageView.image = [self buttonImage];
+ [self setImage: [self buttonImage]
+ forState: UIControlStateNormal];
+
+ [self setImage: [self buttonHighlightedImage]
+ forState: UIControlStateHighlighted |UIControlStateSelected];
+
+}
+
+@end
30 sample/DemoApp/DemoApp-Info.plist
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+</dict>
+</plist>
342 sample/DemoApp/DemoApp.xcodeproj/project.pbxproj
@@ -0,0 +1,342 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1D3623260D0F684500981E51 /* DemoAppAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* DemoAppAppDelegate.m */; };
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
+ 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
+ AEA93BB411D52A6E000A4545 /* NSObject+SBJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = AEA93BA011D52A6E000A4545 /* NSObject+SBJSON.m */; };
+ AEA93BB511D52A6E000A4545 /* NSString+SBJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = AEA93BA211D52A6E000A4545 /* NSString+SBJSON.m */; };
+ AEA93BB611D52A6E000A4545 /* SBJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = AEA93BA411D52A6E000A4545 /* SBJSON.m */; };
+ AEA93BB711D52A6E000A4545 /* SBJsonBase.m in Sources */ = {isa = PBXBuildFile; fileRef = AEA93BA611D52A6E000A4545 /* SBJsonBase.m */; };
+ AEA93BB811D52A6E000A4545 /* SBJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = AEA93BA811D52A6E000A4545 /* SBJsonParser.m */; };
+ AEA93BB911D52A6E000A4545 /* SBJsonWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = AEA93BAA11D52A6E000A4545 /* SBJsonWriter.m */; };
+ AEA93BBA11D52A6E000A4545 /* FBRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AEA93BAD11D52A6E000A4545 /* FBRequest.m */; };
+ AEA93BBB11D52A6E000A4545 /* Facebook.m in Sources */ = {isa = PBXBuildFile; fileRef = AEA93BAE11D52A6E000A4545 /* Facebook.m */; };
+ AEA93BBC11D52A6E000A4545 /* FBLoginDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = AEA93BB111D52A6E000A4545 /* FBLoginDialog.m */; };
+ AEA93BBD11D52A6E000A4545 /* FBDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = AEA93BB311D52A6E000A4545 /* FBDialog.m */; };
+ AEE8F64C11CC8E5D008BF99E /* FBConnect.bundle in Resources */ = {isa = PBXBuildFile; fileRef = AEE8F64B11CC8E5D008BF99E /* FBConnect.bundle */; };
+ AEE8F65211CC8EB3008BF99E /* DemoAppViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AEE8F65011CC8EB3008BF99E /* DemoAppViewController.m */; };
+ AEE8F65311CC8EB3008BF99E /* DemoAppViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = AEE8F65111CC8EB3008BF99E /* DemoAppViewController.xib */; };
+ AEE8F65611CC8EF1008BF99E /* FBLoginButton.m in Sources */ = {isa = PBXBuildFile; fileRef = AEE8F65511CC8EF1008BF99E /* FBLoginButton.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1D3623240D0F684500981E51 /* DemoAppAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoAppAppDelegate.h; sourceTree = "<group>"; };
+ 1D3623250D0F684500981E51 /* DemoAppAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoAppAppDelegate.m; sourceTree = "<group>"; };
+ 1D6058910D05DD3D006BFB54 /* DemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 32CA4F630368D1EE00C91783 /* DemoApp_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoApp_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* DemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "DemoApp-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
+ AEA93B9E11D52A6E000A4545 /* JSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSON.h; sourceTree = "<group>"; };
+ AEA93B9F11D52A6E000A4545 /* NSObject+SBJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+SBJSON.h"; sourceTree = "<group>"; };
+ AEA93BA011D52A6E000A4545 /* NSObject+SBJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+SBJSON.m"; sourceTree = "<group>"; };
+ AEA93BA111D52A6E000A4545 /* NSString+SBJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+SBJSON.h"; sourceTree = "<group>"; };
+ AEA93BA211D52A6E000A4545 /* NSString+SBJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+SBJSON.m"; sourceTree = "<group>"; };
+ AEA93BA311D52A6E000A4545 /* SBJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJSON.h; sourceTree = "<group>"; };
+ AEA93BA411D52A6E000A4545 /* SBJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJSON.m; sourceTree = "<group>"; };
+ AEA93BA511D52A6E000A4545 /* SBJsonBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJsonBase.h; sourceTree = "<group>"; };
+ AEA93BA611D52A6E000A4545 /* SBJsonBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJsonBase.m; sourceTree = "<group>"; };
+ AEA93BA711D52A6E000A4545 /* SBJsonParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJsonParser.h; sourceTree = "<group>"; };
+ AEA93BA811D52A6E000A4545 /* SBJsonParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJsonParser.m; sourceTree = "<group>"; };
+ AEA93BA911D52A6E000A4545 /* SBJsonWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJsonWriter.h; sourceTree = "<group>"; };
+ AEA93BAA11D52A6E000A4545 /* SBJsonWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJsonWriter.m; sourceTree = "<group>"; };
+ AEA93BAB11D52A6E000A4545 /* FBConnect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FBConnect.h; path = ../../src/FBConnect.h; sourceTree = SOURCE_ROOT; };
+ AEA93BAC11D52A6E000A4545 /* FBRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FBRequest.h; path = ../../src/FBRequest.h; sourceTree = SOURCE_ROOT; };
+ AEA93BAD11D52A6E000A4545 /* FBRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FBRequest.m; path = ../../src/FBRequest.m; sourceTree = SOURCE_ROOT; };
+ AEA93BAE11D52A6E000A4545 /* Facebook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Facebook.m; path = ../../src/Facebook.m; sourceTree = SOURCE_ROOT; };
+ AEA93BAF11D52A6E000A4545 /* Facebook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Facebook.h; path = ../../src/Facebook.h; sourceTree = SOURCE_ROOT; };
+ AEA93BB011D52A6E000A4545 /* FBLoginDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FBLoginDialog.h; path = ../../src/FBLoginDialog.h; sourceTree = SOURCE_ROOT; };
+ AEA93BB111D52A6E000A4545 /* FBLoginDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FBLoginDialog.m; path = ../../src/FBLoginDialog.m; sourceTree = SOURCE_ROOT; };
+ AEA93BB211D52A6E000A4545 /* FBDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FBDialog.h; path = ../../src/FBDialog.h; sourceTree = SOURCE_ROOT; };
+ AEA93BB311D52A6E000A4545 /* FBDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FBDialog.m; path = ../../src/FBDialog.m; sourceTree = SOURCE_ROOT; };
+ AEE8F64B11CC8E5D008BF99E /* FBConnect.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = FBConnect.bundle; path = ../FBConnect.bundle; sourceTree = SOURCE_ROOT; };
+ AEE8F64F11CC8EB3008BF99E /* DemoAppViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoAppViewController.h; sourceTree = "<group>"; };
+ AEE8F65011CC8EB3008BF99E /* DemoAppViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoAppViewController.m; sourceTree = "<group>"; };
+ AEE8F65111CC8EB3008BF99E /* DemoAppViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DemoAppViewController.xib; path = Classes/DemoAppViewController.xib; sourceTree = "<group>"; };
+ AEE8F65411CC8EF1008BF99E /* FBLoginButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBLoginButton.h; sourceTree = "<group>"; };
+ AEE8F65511CC8EF1008BF99E /* FBLoginButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBLoginButton.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 080E96DDFE201D6D7F000001 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ AEE8F65411CC8EF1008BF99E /* FBLoginButton.h */,
+ AEE8F65511CC8EF1008BF99E /* FBLoginButton.m */,
+ AEE8F65011CC8EB3008BF99E /* DemoAppViewController.m */,
+ AEE8F64F11CC8EB3008BF99E /* DemoAppViewController.h */,
+ 1D3623250D0F684500981E51 /* DemoAppAppDelegate.m */,
+ 1D3623240D0F684500981E51 /* DemoAppAppDelegate.h */,
+ AEE8F64B11CC8E5D008BF99E /* FBConnect.bundle */,
+ );
+ path = Classes;
+ sourceTree = "<group>";
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 1D6058910D05DD3D006BFB54 /* DemoApp.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ AEA93B9C11D52A6E000A4545 /* FBConnect */,
+ 080E96DDFE201D6D7F000001 /* Classes */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 32CA4F630368D1EE00C91783 /* DemoApp_Prefix.pch */,
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ );
+ name = "Other Sources";
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ AEE8F65111CC8EB3008BF99E /* DemoAppViewController.xib */,
+ 28AD733E0D9D9553002E5188 /* MainWindow.xib */,
+ 8D1107310486CEB800E47090 /* DemoApp-Info.plist */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ AEA93B9C11D52A6E000A4545 /* FBConnect */ = {
+ isa = PBXGroup;
+ children = (
+ AEA93B9D11D52A6E000A4545 /* JSON */,
+ AEA93BAB11D52A6E000A4545 /* FBConnect.h */,
+ AEA93BAC11D52A6E000A4545 /* FBRequest.h */,
+ AEA93BAD11D52A6E000A4545 /* FBRequest.m */,
+ AEA93BAE11D52A6E000A4545 /* Facebook.m */,
+ AEA93BAF11D52A6E000A4545 /* Facebook.h */,
+ AEA93BB011D52A6E000A4545 /* FBLoginDialog.h */,
+ AEA93BB111D52A6E000A4545 /* FBLoginDialog.m */,
+ AEA93BB211D52A6E000A4545 /* FBDialog.h */,
+ AEA93BB311D52A6E000A4545 /* FBDialog.m */,
+ );
+ name = FBConnect;
+ sourceTree = "<group>";
+ };
+ AEA93B9D11D52A6E000A4545 /* JSON */ = {
+ isa = PBXGroup;
+ children = (
+ AEA93B9E11D52A6E000A4545 /* JSON.h */,
+ AEA93B9F11D52A6E000A4545 /* NSObject+SBJSON.h */,
+ AEA93BA011D52A6E000A4545 /* NSObject+SBJSON.m */,
+ AEA93BA111D52A6E000A4545 /* NSString+SBJSON.h */,
+ AEA93BA211D52A6E000A4545 /* NSString+SBJSON.m */,
+ AEA93BA311D52A6E000A4545 /* SBJSON.h */,
+ AEA93BA411D52A6E000A4545 /* SBJSON.m */,
+ AEA93BA511D52A6E000A4545 /* SBJsonBase.h */,
+ AEA93BA611D52A6E000A4545 /* SBJsonBase.m */,
+ AEA93BA711D52A6E000A4545 /* SBJsonParser.h */,
+ AEA93BA811D52A6E000A4545 /* SBJsonParser.m */,
+ AEA93BA911D52A6E000A4545 /* SBJsonWriter.h */,
+ AEA93BAA11D52A6E000A4545 /* SBJsonWriter.m */,
+ );
+ name = JSON;
+ path = ../../src/JSON;
+ sourceTree = SOURCE_ROOT;
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1D6058900D05DD3D006BFB54 /* DemoApp */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "DemoApp" */;
+ buildPhases = (
+ 1D60588D0D05DD3D006BFB54 /* Resources */,
+ 1D60588E0D05DD3D006BFB54 /* Sources */,
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = DemoApp;
+ productName = DemoApp;
+ productReference = 1D6058910D05DD3D006BFB54 /* DemoApp.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DemoApp" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1D6058900D05DD3D006BFB54 /* DemoApp */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1D60588D0D05DD3D006BFB54 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
+ AEE8F64C11CC8E5D008BF99E /* FBConnect.bundle in Resources */,
+ AEE8F65311CC8EB3008BF99E /* DemoAppViewController.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1D60588E0D05DD3D006BFB54 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
+ 1D3623260D0F684500981E51 /* DemoAppAppDelegate.m in Sources */,
+ AEE8F65211CC8EB3008BF99E /* DemoAppViewController.m in Sources */,
+ AEE8F65611CC8EF1008BF99E /* FBLoginButton.m in Sources */,
+ AEA93BB411D52A6E000A4545 /* NSObject+SBJSON.m in Sources */,
+ AEA93BB511D52A6E000A4545 /* NSString+SBJSON.m in Sources */,
+ AEA93BB611D52A6E000A4545 /* SBJSON.m in Sources */,
+ AEA93BB711D52A6E000A4545 /* SBJsonBase.m in Sources */,
+ AEA93BB811D52A6E000A4545 /* SBJsonParser.m in Sources */,
+ AEA93BB911D52A6E000A4545 /* SBJsonWriter.m in Sources */,
+ AEA93BBA11D52A6E000A4545 /* FBRequest.m in Sources */,
+ AEA93BBB11D52A6E000A4545 /* Facebook.m in Sources */,
+ AEA93BBC11D52A6E000A4545 /* FBLoginDialog.m in Sources */,
+ AEA93BBD11D52A6E000A4545 /* FBDialog.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 1D6058940D05DD3E006BFB54 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = DemoApp_Prefix.pch;
+ INFOPLIST_FILE = "DemoApp-Info.plist";
+ PRODUCT_NAME = DemoApp;
+ };
+ name = Debug;
+ };
+ 1D6058950D05DD3E006BFB54 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = DemoApp_Prefix.pch;
+ INFOPLIST_FILE = "DemoApp-Info.plist";
+ PRODUCT_NAME = DemoApp;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = iphoneos3.1.3;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ PREBINDING = NO;
+ SDKROOT = iphoneos3.1.3;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "DemoApp" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1D6058940D05DD3E006BFB54 /* Debug */,
+ 1D6058950D05DD3E006BFB54 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DemoApp" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
8 sample/DemoApp/DemoApp_Prefix.pch
@@ -0,0 +1,8 @@
+//
+// Prefix header for all source files of the 'DemoApp' target in the 'DemoApp' project
+//
+
+#ifdef __OBJC__
+ #import <Foundation/Foundation.h>
+ #import <UIKit/UIKit.h>
+#endif
198 sample/DemoApp/MainWindow.xib
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">800</int>
+ <string key="IBDocument.SystemVersion">10D540</string>
+ <string key="IBDocument.InterfaceBuilderVersion">760</string>
+ <string key="IBDocument.AppKitVersion">1038.29</string>
+ <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">81</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="2"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="841351856">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="427554174">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUICustomObject" id="664661524">
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIWindow" id="380026005">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">1316</int>
+ <object class="NSPSMatrix" key="NSFrameMatrix"/>
+ <string key="NSFrameSize">{320, 480}</string>
+ <reference key="NSSuperview"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MSAxIDEAA</bytes>
+ </object>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBUIResizesToFullScreen">YES</bool>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="841351856"/>
+ <reference key="destination" ref="664661524"/>
+ </object>
+ <int key="connectionID">4</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">window</string>
+ <reference key="source" ref="664661524"/>
+ <reference key="destination" ref="380026005"/>
+ </object>
+ <int key="connectionID">5</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">2</int>
+ <reference key="object" ref="380026005"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="841351856"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3</int>
+ <reference key="object" ref="664661524"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="427554174"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>2.IBAttributePlaceholdersKey</string>
+ <string>2.IBEditorWindowLastContentRect</string>
+ <string>2.IBPluginDependency</string>
+ <string>3.CustomClassName</string>
+ <string>3.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>UIApplication</string>
+ <string>UIResponder</string>
+ <object class="NSMutableDictionary">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <string>{{198, 376}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>DemoAppAppDelegate</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">9</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">DemoAppAppDelegate</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">window</string>
+ <string key="NS.object.0">UIWindow</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/DemoAppAppDelegate.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">DemoAppAppDelegate</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3100" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">DemoApp.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">81</string>
+ </data>
+</archive>
26 sample/DemoApp/main.m
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2009-2010 Facebook
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#import <UIKit/UIKit.h>
+
+int main(int argc, char *argv[]) {
+
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, nil);
+ [pool release];
+ return retVal;
+}
BIN sample/FBConnect.bundle/images/login.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN sample/FBConnect.bundle/images/login_down.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN sample/FBConnect.bundle/images/logout.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN sample/FBConnect.bundle/images/logout_down.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 src/FBConnect.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2009-2010 Facebook
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "Facebook.h"
+#include "FBDialog.h"
+#include "FBLoginDialog.h"
+#include "FBRequest.h"
+#include "SBJSON.h"
148 src/FBDialog.h
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2009 Facebook
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+@protocol FBDialogDelegate;
+
+/**
+ * Do not use this interface directly, instead, use dialog in Facebook.h
+ *
+ * Facebook dialog interface for start the facebook webView UIServer Dialog.
+ */
+
+@interface FBDialog : UIView <UIWebViewDelegate> {
+ id<FBDialogDelegate> _delegate;
+ NSMutableDictionary *_params;
+ NSString * _serverURL;
+ NSURL* _loadingURL;
+ UIWebView* _webView;
+ UIActivityIndicatorView* _spinner;
+ UIImageView* _iconView;
+ UILabel* _titleLabel;
+ UIButton* _closeButton;
+ UIDeviceOrientation _orientation;
+ BOOL _showingKeyboard;
+}
+
+/**
+ * The delegate.
+ */
+@property(nonatomic,assign) id<FBDialogDelegate> delegate;
+
+/**
+ * The parameters.
+ */
+@property(nonatomic, retain) NSMutableDictionary* params;
+
+/**
+ * The title that is shown in the header atop the view.
+ */
+@property(nonatomic,copy) NSString* title;
+
+- (id)initWithURL: (NSString *) loadingURL
+ params: (NSMutableDictionary *) params
+ delegate: (id <FBDialogDelegate>) delegate;
+
+/**
+ * Displays the view with an animation.
+ *
+ * The view will be added to the top of the current key window.
+ */
+- (void)show;
+
+/**
+ * Displays the first page of the dialog.
+ *
+ * Do not ever call this directly. It is intended to be overriden by subclasses.
+ */
+- (void)load;
+
+/**
+ * Displays a URL in the dialog.
+ */
+- (void)loadURL:(NSString*)url
+ method:(NSString*)method
+ get:(NSDictionary*)getParams
+ post:(NSDictionary*)postParams;
+
+/**
+ * Hides the view and notifies delegates of success or cancellation.
+ */
+- (void)dismissWithSuccess:(BOOL)success animated:(BOOL)animated;
+
+/**
+ * Hides the view and notifies delegates of an error.
+ */
+- (void)dismissWithError:(NSError*)error animated:(BOOL)animated;
+
+/**
+ * Subclasses may override to perform actions just prior to showing the dialog.
+ */
+- (void)dialogWillAppear;
+
+/**
+ * Subclasses may override to perform actions just after the dialog is hidden.
+ */
+- (void)dialogWillDisappear;
+
+/**
+ * Subclasses should override to process data returned from the server in a 'fbconnect' url.
+ *
+ * Implementations must call dismissWithSuccess:YES at some point to hide the dialog.
+ */
+- (void)dialogDidSucceed:(NSURL*)url;
+
+@end
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+/*
+ *Your application should implement this delegate
+ */
+@protocol FBDialogDelegate <NSObject>
+
+@optional
+
+/**
+ * Called when the dialog succeeds and is about to be dismissed.
+ */
+- (void)dialogDidSucceed:(FBDialog*)dialog;
+
+/**
+ * Called when the dialog is cancelled and is about to be dismissed.
+ */
+- (void)dialogDidCancel:(FBDialog*)dialog;
+
+/**
+ * Called when dialog failed to load due to an error.
+ */
+- (void)dialog:(FBDialog*)dialog didFailWithError:(NSError*)error;
+
+/**
+ * Asks if a link touched by a user should be opened in an external browser.
+ *
+ * If a user touches a link, the default behavior is to open the link in the Safari browser,
+ * which will cause your app to quit. You may want to prevent this from happening, open the link
+ * in your own internal browser, or perhaps warn the user that they are about to leave your app.
+ * If so, implement this method on your delegate and return NO. If you warn the user, you
+ * should hold onto the URL and once you have received their acknowledgement open the URL yourself
+ * using [[UIApplication sharedApplication] openURL:].
+ */
+- (BOOL)dialog:(FBDialog*)dialog shouldOpenURLInExternalBrowser:(NSURL*)url;
+
+@end
640 src/FBDialog.m
@@ -0,0 +1,640 @@
+/*
+ * Copyright 2009 Facebook
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+
+#import "FBDialog.h"
+#import "Facebook.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// global
+
+static NSString* kDefaultTitle = @"Connect to Facebook";
+static NSString* kStringBoundary = @"3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f";
+
+static CGFloat kFacebookBlue[4] = {0.42578125, 0.515625, 0.703125, 1.0};
+static CGFloat kBorderGray[4] = {0.3, 0.3, 0.3, 0.8};
+static CGFloat kBorderBlack[4] = {0.3, 0.3, 0.3, 1};
+static CGFloat kBorderBlue[4] = {0.23, 0.35, 0.6, 1.0};
+
+static CGFloat kTransitionDuration = 0.3;
+
+static CGFloat kTitleMarginX = 8;
+static CGFloat kTitleMarginY = 4;
+static CGFloat kPadding = 10;
+static CGFloat kBorderWidth = 10;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+BOOL FBIsDeviceIPad() {
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
+ return YES;
+ }
+#endif
+ return NO;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+@implementation FBDialog
+
+@synthesize delegate = _delegate,
+ params = _params;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// private
+
+- (void)addRoundedRectToPath:(CGContextRef)context rect:(CGRect)rect radius:(float)radius {
+ CGContextBeginPath(context);
+ CGContextSaveGState(context);
+
+ if (radius == 0) {
+ CGContextTranslateCTM(context, CGRectGetMinX(rect), CGRectGetMinY(rect));
+ CGContextAddRect(context, rect);
+ } else {
+ rect = CGRectOffset(CGRectInset(rect, 0.5, 0.5), 0.5, 0.5);
+ CGContextTranslateCTM(context, CGRectGetMinX(rect)-0.5, CGRectGetMinY(rect)-0.5);
+ CGContextScaleCTM(context, radius, radius);
+ float fw = CGRectGetWidth(rect) / radius;
+ float fh = CGRectGetHeight(rect) / radius;
+
+ CGContextMoveToPoint(context, fw, fh/2);
+ CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1);
+ CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1);
+ CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1);
+ CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1);
+ }
+
+ CGContextClosePath(context);
+ CGContextRestoreGState(context);
+}
+
+- (void)drawRect:(CGRect)rect fill:(const CGFloat*)fillColors radius:(CGFloat)radius {
+ CGContextRef context = UIGraphicsGetCurrentContext();
+ CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
+
+ if (fillColors) {
+ CGContextSaveGState(context);
+ CGContextSetFillColor(context, fillColors);
+ if (radius) {
+ [self addRoundedRectToPath:context rect:rect radius:radius];
+ CGContextFillPath(context);
+ } else {
+ CGContextFillRect(context, rect);
+ }
+ CGContextRestoreGState(context);
+ }
+
+ CGColorSpaceRelease(space);
+}
+
+- (void)strokeLines:(CGRect)rect stroke:(const CGFloat*)strokeColor {
+ CGContextRef context = UIGraphicsGetCurrentContext();
+ CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
+
+ CGContextSaveGState(context);