Skip to content

Commit

Permalink
Facebook iOS SDK 3.11.1
Browse files Browse the repository at this point in the history
Summary:
    see https://developers.facebook.com/ios/change-log-3.x/

Upgrading:
    https://developers.facebook.com/docs/ios/upgrading/

Reviewed By: jacl

Test Plan: Release Testing.
  • Loading branch information
toddkrabach committed Jan 17, 2014
1 parent 3c38d5d commit 283b0d0
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 43 deletions.
2 changes: 1 addition & 1 deletion scripts/build_documentation.sh
Expand Up @@ -45,7 +45,7 @@ rm -rf $DOCSET


hash $APPLEDOC &>/dev/null hash $APPLEDOC &>/dev/null
if [ "$?" -eq "0" ]; then if [ "$?" -eq "0" ]; then
APPLEDOC_DOCSET_NAME="Facebook SDK 3.11 for iOS" APPLEDOC_DOCSET_NAME="Facebook SDK 3.11.1 for iOS"
$APPLEDOC --project-name "$APPLEDOC_DOCSET_NAME" \ $APPLEDOC --project-name "$APPLEDOC_DOCSET_NAME" \
--project-company "Facebook" \ --project-company "Facebook" \
--company-id "com.facebook" \ --company-id "com.facebook" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/productbuild_distribution.xml
Expand Up @@ -12,7 +12,7 @@
<pkg-ref id="com.facebook.sdk.pkg"/> <pkg-ref id="com.facebook.sdk.pkg"/>
</choice> </choice>


<title>Facebook SDK 3.11 for iOS</title> <title>Facebook SDK 3.11.1 for iOS</title>
<conclusion file="README.txt" mime-type="text/plain" /> <conclusion file="README.txt" mime-type="text/plain" />
<readme file="README.txt" mime-type="text/plain" /> <readme file="README.txt" mime-type="text/plain" />
<domains enable_currentUserHome="true" /> <domains enable_currentUserHome="true" />
Expand Down
6 changes: 3 additions & 3 deletions src/FBRequestConnection.m
Expand Up @@ -1234,11 +1234,11 @@ - (void)completeWithResults:(NSArray *)results
} queue:dispatch_get_main_queue()]; } queue:dispatch_get_main_queue()];


taskWork = [taskWork completionTaskWithQueue:dispatch_get_main_queue() block:^id(FBTask *task) { taskWork = [taskWork completionTaskWithQueue:dispatch_get_main_queue() block:^id(FBTask *task) {
if (task.result == ACAccountCredentialRenewResultRenewed) { if ([@(ACAccountCredentialRenewResultRenewed) isEqual:task.result]) {
FBTask *requestAccessTask = [systemAccountStoreAdapter requestAccessToFacebookAccountStoreAsTask:metadata.request.session]; FBTask *requestAccessTask = [systemAccountStoreAdapter requestAccessToFacebookAccountStoreAsTask:metadata.request.session];
return [requestAccessTask completionTaskWithQueue:dispatch_get_main_queue() block:^id(FBTask *task) { return [requestAccessTask completionTaskWithQueue:dispatch_get_main_queue() block:^id(FBTask *task) {
if (task.result) { // aka success means task.result == (oauthToken) if (task.result && [task.result isKindOfClass:[NSString class]]) { // aka success means task.result == (oauthToken)
[metadata.request.session refreshAccessToken:task.result expirationDate:[NSDate distantFuture]]; [metadata.request.session refreshAccessToken:(NSString *)task.result expirationDate:[NSDate distantFuture]];
[metadata invokeCompletionHandlerForConnection:self [metadata invokeCompletionHandlerForConnection:self
withResults:body withResults:body
error:[FBErrorUtility fberrorForRetry:unpackedError]]; error:[FBErrorUtility fberrorForRetry:unpackedError]];
Expand Down
7 changes: 0 additions & 7 deletions src/FBSystemAccountStoreAdapter.h
Expand Up @@ -31,13 +31,6 @@ typedef void (^FBRequestAccessToAccountsHandler)(NSString* oauthToken, NSError *
*/ */
@interface FBSystemAccountStoreAdapter : NSObject @interface FBSystemAccountStoreAdapter : NSObject


/*
@abstract A convenience overload to default various parameters based on the provided session,
typically only for requesting a new token for the provided session.
*/
- (void)requestAccessToFacebookAccountStore:(FBSession *)session
handler:(FBRequestAccessToAccountsHandler)handler;

/* /*
@abstract @abstract
Requests access to the device's Facebook account for the given parameters. Requests access to the device's Facebook account for the given parameters.
Expand Down
22 changes: 8 additions & 14 deletions src/FBSystemAccountStoreAdapter.m
Expand Up @@ -106,8 +106,13 @@ - (BOOL) canRequestAccessWithoutUI {
#pragma mark - Public properties and methods #pragma mark - Public properties and methods


- (FBTask *)requestAccessToFacebookAccountStoreAsTask:(FBSession *)session { - (FBTask *)requestAccessToFacebookAccountStoreAsTask:(FBSession *)session {
FBTaskCompletionSource* tcs = [FBTaskCompletionSource taskCompletionSource]; FBTaskCompletionSource *tcs = [FBTaskCompletionSource taskCompletionSource];
[self requestAccessToFacebookAccountStore:session handler:^(NSString *oauthToken, NSError *accountStoreError) { [self requestAccessToFacebookAccountStore:nil
defaultAudience:session.lastRequestedSystemAudience
isReauthorize:NO
appID:session.appID
session:session
handler:^(NSString *oauthToken, NSError *accountStoreError) {
if (accountStoreError) { if (accountStoreError) {
[tcs setError:accountStoreError]; [tcs setError:accountStoreError];
} else { } else {
Expand All @@ -117,17 +122,6 @@ - (FBTask *)requestAccessToFacebookAccountStoreAsTask:(FBSession *)session {
return tcs.task; return tcs.task;
} }



- (void)requestAccessToFacebookAccountStore:(FBSession *)session
handler:(FBRequestAccessToAccountsHandler)handler {
return [self requestAccessToFacebookAccountStore:session.accessTokenData.permissions
defaultAudience:session.lastRequestedSystemAudience
isReauthorize:NO
appID:session.appID
session:session
handler:handler];
}

- (void)requestAccessToFacebookAccountStore:(NSArray *)permissions - (void)requestAccessToFacebookAccountStore:(NSArray *)permissions
defaultAudience:(FBSessionDefaultAudience)defaultAudience defaultAudience:(FBSessionDefaultAudience)defaultAudience
isReauthorize:(BOOL)isReauthorize isReauthorize:(BOOL)isReauthorize
Expand Down Expand Up @@ -312,7 +306,7 @@ - (FBTask *)renewSystemAuthorizationAsTask {
if (error) { if (error) {
[tcs setError:error]; [tcs setError:error];
} else { } else {
[tcs setResult:result]; [tcs setResult:@(result)];
} }
}]; }];
return tcs.task; return tcs.task;
Expand Down
4 changes: 2 additions & 2 deletions src/FBTask.h
Expand Up @@ -26,7 +26,7 @@
/*! /*!
Creates a task that is already completed with the given result. Creates a task that is already completed with the given result.
*/ */
+ (FBTask *)taskWithResult:(id)result; + (FBTask *)taskWithResult:(id<NSObject>)result;


/*! /*!
Creates a task that is already completed with the given error. Creates a task that is already completed with the given error.
Expand Down Expand Up @@ -61,7 +61,7 @@
/*! /*!
The result of a successful task. The result of a successful task.
*/ */
- (id)result; - (id<NSObject>)result;


/*! /*!
The error of a failed task. The error of a failed task.
Expand Down
19 changes: 11 additions & 8 deletions src/FBTask.m
Expand Up @@ -26,7 +26,7 @@
} }


@interface FBTask () { @interface FBTask () {
id _result; id<NSObject> _result;
NSError *_error; NSError *_error;
NSException *_exception; NSException *_exception;
BOOL _cancelled; BOOL _cancelled;
Expand All @@ -53,11 +53,14 @@ - (void)dealloc {
[_lock release]; [_lock release];
[_condition release]; [_condition release];
[_callbacks release]; [_callbacks release];
[_result release];
[_error release];
[_exception release];


[super dealloc]; [super dealloc];
} }


+ (FBTask *)taskWithResult:(id)result { + (FBTask *)taskWithResult:(id<NSObject>)result {
FBTaskCompletionSource *tcs = [FBTaskCompletionSource taskCompletionSource]; FBTaskCompletionSource *tcs = [FBTaskCompletionSource taskCompletionSource];
tcs.result = result; tcs.result = result;
return tcs.task; return tcs.task;
Expand Down Expand Up @@ -107,26 +110,26 @@ + (FBTask *)taskWithDelay:(dispatch_time_t)delay {
return tcs.task; return tcs.task;
} }


- (id)result { - (id<NSObject>)result {
@synchronized (self.lock) { @synchronized (self.lock) {
return _result; return _result;
} }
} }


- (void)setResult:(id)result { - (void)setResult:(id<NSObject>)result {
if (![self trySetResult:result]) { if (![self trySetResult:result]) {
[NSException raise:NSInternalInconsistencyException [NSException raise:NSInternalInconsistencyException
format:@"Cannot set the result on a completed task."]; format:@"Cannot set the result on a completed task."];
} }
} }


- (BOOL)trySetResult:(id)result { - (BOOL)trySetResult:(id<NSObject>)result {
@synchronized (self.lock) { @synchronized (self.lock) {
if (self.completed) { if (self.completed) {
return NO; return NO;
} }
self.completed = YES; self.completed = YES;
_result = result; _result = [result retain];
[self runContinuations]; [self runContinuations];
return YES; return YES;
} }
Expand All @@ -151,7 +154,7 @@ - (BOOL)trySetError:(NSError *)error {
return NO; return NO;
} }
self.completed = YES; self.completed = YES;
_error = error; _error = [error retain];
[self runContinuations]; [self runContinuations];
return YES; return YES;
} }
Expand All @@ -176,7 +179,7 @@ - (BOOL)trySetException:(NSException *)exception {
return NO; return NO;
} }
self.completed = YES; self.completed = YES;
_exception = exception; _exception = [exception retain];
[self runContinuations]; [self runContinuations];
return YES; return YES;
} }
Expand Down
4 changes: 2 additions & 2 deletions src/FBTaskCompletionSource.h
Expand Up @@ -38,7 +38,7 @@
Completes the task by setting the result. Completes the task by setting the result.
Attempting to set this for a completed task will raise an exception. Attempting to set this for a completed task will raise an exception.
*/ */
- (void)setResult:(id)result; - (void)setResult:(id<NSObject>)result;


/*! /*!
Completes the task by setting the error. Completes the task by setting the error.
Expand All @@ -62,7 +62,7 @@
Sets the result of the task if it wasn't already completed. Sets the result of the task if it wasn't already completed.
@returns whether the new value was set. @returns whether the new value was set.
*/ */
- (BOOL)trySetResult:(id)result; - (BOOL)trySetResult:(id<NSObject>)result;


/*! /*!
Sets the error of the task if it wasn't already completed. Sets the error of the task if it wasn't already completed.
Expand Down
8 changes: 4 additions & 4 deletions src/FBTaskCompletionSource.m
Expand Up @@ -23,11 +23,11 @@ @interface FBTaskCompletionSource ()
@end @end


@interface FBTask (FBTaskCompletionSource) @interface FBTask (FBTaskCompletionSource)
- (void)setResult:(id)result; - (void)setResult:(id<NSObject>)result;
- (void)setError:(NSError *)error; - (void)setError:(NSError *)error;
- (void)setException:(NSException *)exception; - (void)setException:(NSException *)exception;
- (void)cancel; - (void)cancel;
- (BOOL)trySetResult:(id)result; - (BOOL)trySetResult:(id<NSObject>)result;
- (BOOL)trySetError:(NSError *)error; - (BOOL)trySetError:(NSError *)error;
- (BOOL)trySetException:(NSException *)exception; - (BOOL)trySetException:(NSException *)exception;
- (BOOL)trySetCancelled; - (BOOL)trySetCancelled;
Expand All @@ -52,7 +52,7 @@ - (void)dealloc {
[super dealloc]; [super dealloc];
} }


- (void)setResult:(id)result { - (void)setResult:(id<NSObject>)result {
[self.task setResult:result]; [self.task setResult:result];
} }


Expand All @@ -68,7 +68,7 @@ - (void)cancel {
[self.task cancel]; [self.task cancel];
} }


- (BOOL)trySetResult:(id)result { - (BOOL)trySetResult:(id<NSObject>)result {
return [self.task trySetResult:result]; return [self.task trySetResult:result];
} }


Expand Down
2 changes: 1 addition & 1 deletion src/FacebookSDK.h
Expand Up @@ -135,5 +135,5 @@
*/ */


#define FB_IOS_SDK_VERSION_STRING @"3.11.0" #define FB_IOS_SDK_VERSION_STRING @"3.11.1"


0 comments on commit 283b0d0

Please sign in to comment.