Permalink
Browse files

Merge branch 'master' of https://github.com/facebook/facebook-ios-sdk

  • Loading branch information...
2 parents 719260d + ce2838b commit 04ab1d1e289c8c345c99ede656aab0f987a5251e Christine Abernathy committed Oct 10, 2011
Showing with 48 additions and 38 deletions.
  1. +7 −4 sample/DemoApp/DemoApp.xcodeproj/project.pbxproj
  2. +4 −3 src/Facebook.h
  3. +37 −31 src/Facebook.m
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 45;
+ objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
@@ -214,8 +214,11 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0410;
+ };
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DemoApp" */;
- compatibilityVersion = "Xcode 3.1";
+ compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
@@ -283,6 +286,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = DemoApp_Prefix.pch;
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
INFOPLIST_FILE = "DemoApp-Info.plist";
PRODUCT_NAME = DemoApp;
PROVISIONING_PROFILE = "";
@@ -302,6 +306,7 @@
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = DemoApp_Prefix.pch;
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
INFOPLIST_FILE = "DemoApp-Info.plist";
PRODUCT_NAME = DemoApp;
PROVISIONING_PROFILE = "";
@@ -324,7 +329,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
SDKROOT = iphoneos;
VALID_ARCHS = "armv7 armv6";
};
@@ -342,7 +346,6 @@
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
- PREBINDING = NO;
SDKROOT = iphoneos;
VALID_ARCHS = "armv7 armv6";
};
View
@@ -45,10 +45,11 @@
- (id)initWithAppId:(NSString *)appId
andDelegate:(id<FBSessionDelegate>)delegate;
-- (void)authorize:(NSArray *)permissions;
+- (id)initWithAppId:(NSString *)appId
+ urlSchemeSuffix:(NSString *)urlSchemeSuffix
+ andDelegate:(id<FBSessionDelegate>)delegate;
-- (void)authorize:(NSArray *)permissions
- urlSchemeSuffix:(NSString *)urlSchemeSuffix;
+- (void)authorize:(NSArray *)permissions;
- (BOOL)handleOpenURL:(NSURL *)url;
View
@@ -36,6 +36,7 @@ @interface Facebook ()
// private properties
@property(nonatomic, retain) NSArray* permissions;
+@property(nonatomic, copy) NSString* appId;
@end
@@ -47,23 +48,54 @@ @implementation Facebook
expirationDate = _expirationDate,
sessionDelegate = _sessionDelegate,
permissions = _permissions,
- urlSchemeSuffix = _urlSchemeSuffix;
+ urlSchemeSuffix = _urlSchemeSuffix,
+ appId = _appId;
///////////////////////////////////////////////////////////////////////////////////////////////////
// private
+- (id)initWithAppId:(NSString *)appId
+ andDelegate:(id<FBSessionDelegate>)delegate {
+ self = [self initWithAppId:appId urlSchemeSuffix:nil andDelegate:delegate];
+ return self;
+}
+
/**
* Initialize the Facebook object with application ID.
+ *
+ * @param appId the facebook app id
+ * @param urlSchemeSuffix
+ * urlSchemeSuffix is a string of lowercase letters that is
+ * appended to the base URL scheme used for SSO. For example,
+ * if your facebook ID is "350685531728" and you set urlSchemeSuffix to
+ * "abcd", the Facebook app will expect your application to bind to
+ * the following URL scheme: "fb350685531728abcd".
+ * This is useful if your have multiple iOS applications that
+ * share a single Facebook application id (for example, if you
+ * have a free and a paid version on the same app) and you want
+ * to use SSO with both apps. Giving both apps different
+ * urlSchemeSuffix values will allow the Facebook app to disambiguate
+ * their URL schemes and always redirect the user back to the
+ * correct app, even if both the free and the app is installed
+ * on the device.
+ * urlSchemeSuffix is supported on version 3.4.1 and above of the Facebook
+ * app. If the user has an older version of the Facebook app
+ * installed and your app uses urlSchemeSuffix parameter, the SDK will
+ * proceed as if the Facebook app isn't installed on the device
+ * and redirect the user to Safari.
+ * @param delegate the FBSessionDelegate
*/
- (id)initWithAppId:(NSString *)appId
- andDelegate:(id<FBSessionDelegate>)delegate {
+ urlSchemeSuffix:(NSString *)urlSchemeSuffix
+ andDelegate:(id<FBSessionDelegate>)delegate {
+
self = [super init];
if (self) {
- [_appId release];
- _appId = [appId copy];
+ self.appId = appId;
self.sessionDelegate = delegate;
+ self.urlSchemeSuffix = urlSchemeSuffix;
}
return self;
}
@@ -211,11 +243,6 @@ - (NSDictionary*)parseURLParams:(NSString *)query {
///////////////////////////////////////////////////////////////////////////////////////////////////
//public
-- (void)authorize:(NSArray *)permissions {
- [self authorize:permissions
- urlSchemeSuffix:nil];
-}
-
/**
* Starts a dialog which prompts the user to log in to Facebook and grant
* the requested permissions to the application.
@@ -244,29 +271,8 @@ - (void)authorize:(NSArray *)permissions {
* @param delegate
* Callback interface for notifying the calling application when
* the user has logged in.
- * @param urlSchemeSuffix
- * urlSchemeSuffix is a string of lowercase letters that is
- * appended to the base URL scheme used for SSO. For example,
- * if your facebook ID is "350685531728" and you set urlSchemeSuffix to
- * "abcd", the Facebook app will expect your application to bind to
- * the following URL scheme: "fb350685531728abcd".
- * This is useful if your have multiple iOS applications that
- * share a single Facebook application id (for example, if you
- * have a free and a paid version on the same app) and you want
- * to use SSO with both apps. Giving both apps different
- * urlSchemeSuffix values will allow the Facebook app to disambiguate
- * their URL schemes and always redirect the user back to the
- * correct app, even if both the free and the app is installed
- * on the device.
- * urlSchemeSuffix is supported on version 3.4.1 and above of the Facebook
- * app. If the user has an older version of the Facebook app
- * installed and your app uses urlSchemeSuffix parameter, the SDK will
- * proceed as if the Facebook app isn't installed on the device
- * and redirect the user to Safari.
*/
-- (void)authorize:(NSArray *)permissions
- urlSchemeSuffix:(NSString *)urlSchemeSuffix {
- self.urlSchemeSuffix = urlSchemeSuffix;
+- (void)authorize:(NSArray *)permissions {
self.permissions = permissions;
[self authorizeWithFBAppAuth:YES safariAuth:YES];

0 comments on commit 04ab1d1

Please sign in to comment.