Skip to content

Commit

Permalink
Facebook iOS SDK 4.12
Browse files Browse the repository at this point in the history
  • Loading branch information
ahujap-fb committed May 19, 2016
2 parents 4f4cdf4 + 51f32bb commit c570eae
Show file tree
Hide file tree
Showing 38 changed files with 182 additions and 80 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@
url = git://github.com/facebook/xctool.git


[submodule "FBNotifications"]
path = FBNotifications
url = https://github.com/facebook/FBNotifications.git
3 changes: 3 additions & 0 deletions Configurations/FacebookSDK-Application.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

// Code signing
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer

// Deployment
DSTROOT = /tmp/$(TARGET_NAME)
SKIP_INSTALL = YES
Expand Down
3 changes: 3 additions & 0 deletions Configurations/FacebookSDK-LogicTests.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#include "TestAppIdAndSecret.xcconfig"

// Code signing
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer

// Packaging
WRAPPER_EXTENSION = xctest

Expand Down
1 change: 1 addition & 0 deletions FBNotifications
Submodule FBNotifications added at 066601
4 changes: 2 additions & 2 deletions FBSDKCoreKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Pod::Spec.new do |s|

s.name = "FBSDKCoreKit"
s.version = "4.11.0"
s.version = "4.12.0"
s.summary = "Official Facebook SDK for iOS to access Facebook Platform's core features"

s.description = <<-DESC
Expand All @@ -22,7 +22,7 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '9.0'

s.source = { :git => "https://github.com/facebook/facebook-ios-sdk.git",
:tag => "sdk-version-4.11.0"
:tag => "sdk-version-4.12.0"
}

s.ios.weak_frameworks = 'Accounts', 'CoreLocation', 'Social', 'Security', 'QuartzCore', 'CoreGraphics', 'UIKit', 'Foundation', 'AudioToolbox'
Expand Down
2 changes: 1 addition & 1 deletion FBSDKCoreKit/FBSDKCoreKit/FBSDKAccessToken.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ + (void)setCurrentAccessToken:(FBSDKAccessToken *)token
g_currentAccessToken = token;

// Only need to keep current session in web view for the case when token is current
// When token is abandoned cookies must to be cleaned up immediatelly
// When token is abandoned cookies must to be cleaned up immediately
if (token == nil) {
[FBSDKInternalUtility deleteFacebookCookies];
}
Expand Down
4 changes: 2 additions & 2 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ - (BOOL)application:(UIApplication *)application
}
}

// if they completed a SFVC flow, dimiss it.
// if they completed a SFVC flow, dismiss it.
[_safariViewController.presentingViewController dismissViewControllerAnimated:YES completion: nil];
_safariViewController = nil;

Expand Down Expand Up @@ -288,7 +288,7 @@ - (void)openBridgeAPIRequest:(FBSDKBridgeAPIRequest *)request
_pendingRequestCompletionBlock = nil;
NSError *openedURLError;
if ([request.scheme hasPrefix:@"http"]) {
openedURLError = [FBSDKError errorWithCode:FBSDKBrowswerUnavailableErrorCode
openedURLError = [FBSDKError errorWithCode:FBSDKBrowserUnavailableErrorCode
message:@"the app switch failed because the browser is unavailable"];
} else {
openedURLError = [FBSDKError errorWithCode:FBSDKAppVersionUnsupportedErrorCode
Expand Down
9 changes: 7 additions & 2 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ typedef NS_ENUM(NSInteger, FBSDKErrorCode)
FBSDKNetworkErrorCode,

/*!
@abstract The error code for errors encounted during an App Events flush.
@abstract The error code for errors encountered during an App Events flush.
*/
FBSDKAppEventsFlushErrorCode,

Expand Down Expand Up @@ -102,7 +102,12 @@ typedef NS_ENUM(NSInteger, FBSDKErrorCode)
/*!
@abstract Indicates an app switch to the browser (typically for a dialog) failed.
*/
FBSDKBrowswerUnavailableErrorCode,
FBSDKBrowserUnavailableErrorCode,

/*!
@deprecated use FBSDKBrowserUnavailableErrorCode instead
*/
FBSDKBrowswerUnavailableErrorCode __attribute__ ((deprecated("use FBSDKBrowserUnavailableErrorCode instead"))) = FBSDKBrowserUnavailableErrorCode,
};

/*!
Expand Down
2 changes: 1 addition & 1 deletion FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@
#import <FBSDKCoreKit/FBSDKDeviceViewControllerBase.h>
#endif

#define FBSDK_VERSION_STRING @"4.11.0"
#define FBSDK_VERSION_STRING @"4.12.0"
#define FBSDK_TARGET_PLATFORM_VERSION @"v2.6"
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
/*!
@abstract Attempts to process the error, return YES if the error can be processed.
@param error the error to process.
@param request the relateed request that may be reissued.
@param request the related request that may be reissued.
@param delegate the delegate that will be retained until recovery is complete.
*/
- (BOOL)processError:(NSError *)error request:(FBSDKGraphRequest *)request delegate:(id<FBSDKGraphErrorRecoveryProcessorDelegate>) delegate;
Expand Down
2 changes: 1 addition & 1 deletion FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ typedef void (^FBSDKGraphRequestHandler)(FBSDKGraphRequestConnection *connection
Tells the delegate the request connection finished loading
@discussion
If the request connection completes without a network error occuring then this method is called.
If the request connection completes without a network error occurring then this method is called.
Invocation of this method does not indicate success of every <FBSDKGraphRequest> made, only that the
request connection has no further activity. Use the error argument passed to the FBSDKGraphRequestHandler
block to determine success or failure of each <FBSDKGraphRequest>.
Expand Down
4 changes: 2 additions & 2 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ - (id)parseJSONOrOtherwise:(NSString *)utf8
id parsed = nil;
if (!(*error)) {
parsed = [FBSDKInternalUtility objectForJSONString:utf8 error:error];
// if we fail parse we attemp a reparse of a modified input to support results in the form "foo=bar", "true", etc.
// if we fail parse we attempt a re-parse of a modified input to support results in the form "foo=bar", "true", etc.
// which is shouldn't be necessary since Graph API v2.1.
if (*error) {
// we round-trip our hand-wired response through the parser in order to remain
Expand Down Expand Up @@ -715,7 +715,7 @@ - (void)completeWithResults:(NSArray *)results
}
#endif

[self processResultBody:body error:resultError metadata:metadata canNotifyDelegate:(networkError ? NO : YES)];
[self processResultBody:body error:resultError metadata:metadata canNotifyDelegate:networkError == nil];
}];

if (networkError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ - (void)instanceRestore:(BOOL)calledFromActivateApp

_timeSinceLastSuspend = now - _lastSuspendTime;
_secondsSpentInCurrentSession = [[results objectForKey:FBSDKTimeSpentPersistKeySessionSecondsSpent] intValue];
_sessionID = results[FBSDKTimeSpentPersistKeySessionID];
_sessionID = results[FBSDKTimeSpentPersistKeySessionID] ? : [[NSUUID UUID] UUIDString];
_numInterruptionsInCurrentSession = [[results objectForKey:FBSDKTimeSpentPersistKeySessionNumInterruptions] intValue];
_shouldLogActivateEvent = (_timeSinceLastSuspend > [FBSDKServerConfigurationManager cachedServerConfiguration].sessionTimoutInterval);

Expand Down
6 changes: 3 additions & 3 deletions FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ typedef NS_ENUM(int32_t, FBSDKUIKitVersion)
+ (NSBundle *)bundleForStrings;

/*!
@abstract Converts simple value types to the string equivelant for serializing to a request query or body.
@abstract Converts simple value types to the string equivalent for serializing to a request query or body.
@param value The value to be converted.
@return The value that may have been converted if able (otherwise the input param).
*/
Expand Down Expand Up @@ -260,7 +260,7 @@ setJSONStringForObject:(id)object
@abstract Extracts permissions from a response fetched from me/permissions
@param responseObject the response
@param grantedPermissions the set to add granted permissions to
@param declinedPermissions the set to add decliend permissions to.
@param declinedPermissions the set to add declined permissions to.
*/
+ (void)extractPermissionsFromResponse:(NSDictionary *)responseObject
grantedPermissions:(NSMutableSet *)grantedPermissions
Expand Down Expand Up @@ -302,7 +302,7 @@ setJSONStringForObject:(id)object
/*!
@abstract Attempts to find the first UIViewController in the view's responder chain. Returns nil if not found.
*/
+ (UIViewController *)viewControllerforView:(UIView*)view;
+ (UIViewController *)viewControllerForView:(UIView *)view;

/*!
@abstract returns true if the url scheme is registered in the CFBundleURLTypes
Expand Down
2 changes: 1 addition & 1 deletion FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ + (void)unregisterTransientObject:(__weak id)object
}
}

+ (UIViewController *)viewControllerforView:(UIView*)view
+ (UIViewController *)viewControllerForView:(UIView *)view
{
UIResponder *responder = view.nextResponder;
while (responder) {
Expand Down
8 changes: 4 additions & 4 deletions FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKMonotonicTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ typedef uint64_t FBSDKMachAbsoluteTimeUnits;
* return current monotonic time in Milliseconds
* Millisecond precision, uint64_t value.
* Avoids float/double math operations, thus more efficient than FBSDKMonotonicTimeGetCurrentSeconds.
* Should be prefered over FBSDKMonotonicTimeGetCurrentSeconds in case millisecond
* precision is requred.
* Should be preferred over FBSDKMonotonicTimeGetCurrentSeconds in case millisecond
* precision is required.
* IMPORTANT: this timer doesn't run while the device is sleeping.
*/
FBSDKMonotonicTimeMilliseconds FBSDKMonotonicTimeGetCurrentMilliseconds(void);

/**
* return current monotonic time in Seconds
* Nanosecond precision, double value.
* Should be prefered over FBSDKMonotonicTimeGetCurrentMilliseconds in case
* nanosecond precision is requred.
* Should be preferred over FBSDKMonotonicTimeGetCurrentMilliseconds in case
* nanosecond precision is required.
* IMPORTANT: this timer doesn't run while the device is sleeping.
*/
FBSDKMonotonicTimeSeconds FBSDKMonotonicTimeGetCurrentSeconds(void);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ - (id)initWithCoder:(NSCoder *)decoder
forKey:FBSDK_SERVER_CONFIGURATION_DEFAULT_SHARE_MODE_KEY];
BOOL advertisingIDEnabled = [decoder decodeBoolForKey:FBSDK_SERVER_CONFIGURATION_ADVERTISING_ID_ENABLED_KEY];
BOOL implicitLoggingEnabled = [decoder decodeBoolForKey:FBSDK_SERVER_CONFIGURATION_IMPLICIT_LOGGING_ENABLED_KEY];
BOOL implicitPurchaseLoggingEnabbled =
BOOL implicitPurchaseLoggingEnabled =
[decoder decodeBoolForKey:FBSDK_SERVER_CONFIGURATION_IMPLICIT_PURCHASE_LOGGING_ENABLED_KEY];
BOOL systemAuthenticationEnabled =
[decoder decodeBoolForKey:FBSDK_SERVER_CONFIGURATION_SYSTEM_AUTHENTICATION_ENABLED_KEY];
Expand Down Expand Up @@ -184,7 +184,7 @@ - (id)initWithCoder:(NSCoder *)decoder
defaultShareMode:defaultShareMode
advertisingIDEnabled:advertisingIDEnabled
implicitLoggingEnabled:implicitLoggingEnabled
implicitPurchaseLoggingEnabled:implicitPurchaseLoggingEnabbled
implicitPurchaseLoggingEnabled:implicitPurchaseLoggingEnabled
systemAuthenticationEnabled:systemAuthenticationEnabled
nativeAuthFlowEnabled:nativeAuthFlowEnabled
dialogConfigurations:dialogConfigurations
Expand Down
2 changes: 0 additions & 2 deletions FBSDKCoreKit/FBSDKCoreKit/Internal/UI/FBSDKUIUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ FBSDK_STATIC_INLINE CGSize FBSDKEdgeInsetsInsetSize(CGSize size, UIEdgeInsets in
*/
FBSDK_STATIC_INLINE CGSize FBSDKEdgeInsetsOutsetSize(CGSize size, UIEdgeInsets insets)
{
CGRect rect = CGRectZero;
rect.size = size;
return CGSizeMake(insets.left + size.width + insets.right,
insets.top + size.height + insets.bottom);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,64 @@ - (void)testShareLink
XCTAssertTrue([blocker waitWithTimeout:200], @"couldn't fetch verify post.");
}

- (void)testShareLinkTokenOverride
{
FBSDKTestBlocker *blocker = [[FBSDKTestBlocker alloc] initWithExpectedSignalCount:1];
__block FBSDKAccessToken *tokenWithPublish;
__block FBSDKAccessToken *tokenWithEmail;
[[self testUsersManager] requestTestAccountTokensWithArraysOfPermissions:@[
[NSSet setWithObject:@"publish_actions"],
[NSSet setWithObject:@"email"] ]
createIfNotFound:YES
completionHandler:^(NSArray *tokens, NSError *error) {
tokenWithPublish = tokens[0];
tokenWithEmail = tokens[1];
[blocker signal];
}];
XCTAssertTrue([blocker waitWithTimeout:8], @"failed to fetch two test users for testing");
XCTAssertFalse([tokenWithPublish.userID isEqualToString:tokenWithEmail.userID], @"failed to fetch two distinct users for testing");

// set current token to email token.
[FBSDKAccessToken setCurrentAccessToken:tokenWithEmail];

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"http://www.yahoo.com/"];

blocker = [[FBSDKTestBlocker alloc] initWithExpectedSignalCount:1];
__block NSString *postID = nil;
self.shareCallback = ^(NSDictionary *results, NSError *error, BOOL isCancel) {
NSCAssert(error == nil, @"share failed :%@", error);
NSCAssert(!isCancel, @"share cancelled");
postID = results[@"postId"];
[blocker signal];
};
// but send as the other token
FBSDKShareAPI *sharer = [[FBSDKShareAPI alloc] init];
sharer.shareContent = content;
sharer.delegate = self;
sharer.accessToken = tokenWithPublish;
[sharer share];

XCTAssertTrue([blocker waitWithTimeout:5], @"share didn't complete");
XCTAssertNotNil(postID);

//now fetch and verify the share.
blocker = [[FBSDKTestBlocker alloc] initWithExpectedSignalCount:1];
[[[FBSDKGraphRequest alloc] initWithGraphPath:postID
parameters:@{ @"fields" : @"id,from" }
tokenString:tokenWithPublish.tokenString
version:nil
HTTPMethod:@"GET"
]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
XCTAssertNil(error);
XCTAssertEqualObjects(postID, result[@"id"]);
XCTAssertEqualObjects(tokenWithPublish.userID, result[@"from"][@"id"]);
[blocker signal];
}];
XCTAssertTrue([blocker waitWithTimeout:10], @"couldn't fetch verify post.");
}

#pragma mark - Test Share Photo

- (void)testSharePhoto
Expand Down
4 changes: 2 additions & 2 deletions FBSDKLoginKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Pod::Spec.new do |s|

s.name = "FBSDKLoginKit"
s.version = "4.11.0"
s.version = "4.12.0"
s.summary = "Official Facebook SDK for iOS to access Facebook Platform with features like Login, Share and Message Dialog, App Links, and Graph API"

s.description = <<-DESC
Expand All @@ -21,7 +21,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = "7.0"

s.source = { :git => "https://github.com/facebook/facebook-ios-sdk.git",
:tag => "sdk-version-4.11.0"
:tag => "sdk-version-4.12.0"
}

s.weak_frameworks = "Accounts", "CoreLocation", "Social", "Security", "QuartzCore", "CoreGraphics", "UIKit", "Foundation", "AudioToolbox"
Expand Down
8 changes: 4 additions & 4 deletions FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ - (void)configureButton

[self addTarget:self action:@selector(_buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_acessTokenDidChangeNotification:)
selector:@selector(_accessTokenDidChangeNotification:)
name:FBSDKAccessTokenDidChangeNotification
object:nil];
}

#pragma mark - Helper Methods

- (void)_acessTokenDidChangeNotification:(NSNotification *)notification
- (void)_accessTokenDidChangeNotification:(NSNotification *)notification
{
if (notification.userInfo[FBSDKAccessTokenDidChangeUserID]) {
[self _updateContent];
Expand Down Expand Up @@ -222,11 +222,11 @@ - (void)_buttonPressed:(id)sender

if (self.publishPermissions.count > 0) {
[_loginManager logInWithPublishPermissions:self.publishPermissions
fromViewController:[FBSDKInternalUtility viewControllerforView:self]
fromViewController:[FBSDKInternalUtility viewControllerForView:self]
handler:handler];
} else {
[_loginManager logInWithReadPermissions:self.readPermissions
fromViewController:[FBSDKInternalUtility viewControllerforView:self]
fromViewController:[FBSDKInternalUtility viewControllerForView:self]
handler:handler];
}
}
Expand Down
12 changes: 3 additions & 9 deletions FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ typedef NS_ENUM(NSUInteger, FBSDKLoginBehavior)
*/
FBSDKLoginBehaviorSystemAccount,
/*!
@abstract Attemps log in through a modal \c UIWebView pop up
@abstract Attempts log in through a modal \c UIWebView pop up
@note This behavior is only available to certain types of apps. Please check the Facebook
Platform Policy to verify your app meets the restrictions.
Expand All @@ -105,7 +105,7 @@ typedef NS_ENUM(NSUInteger, FBSDKLoginBehavior)
a cached token available (typically in your viewDidLoad).
If you are managing your own token instances outside of "currentAccessToken", you will need to set
"currentAccessToken" before calling logIn* to authorize futher permissions on your tokens.
"currentAccessToken" before calling logIn* to authorize further permissions on your tokens.
*/
@interface FBSDKLoginManager : NSObject

Expand Down Expand Up @@ -143,9 +143,6 @@ __attribute__ ((deprecated("use logInWithPublishPermissions:fromViewController:h
are needed and explain the value to the user. You can inspect the result.declinedPermissions to also
provide more information to the user if they decline permissions.
If `[FBSDKAccessToken currentAccessToken]` is not nil, it will be treated as a reauthorization for that user
and will pass the "rerequest" flag to the login dialog.
This method will present UI the user. You typically should check if `[FBSDKAccessToken currentAccessToken]`
already contains the permissions you need before asking to reduce unnecessary app switching. For example,
you could make that check at viewDidLoad.
Expand All @@ -165,9 +162,6 @@ __attribute__ ((deprecated("use logInWithPublishPermissions:fromViewController:h
are needed and explain the value to the user. You can inspect the result.declinedPermissions to also
provide more information to the user if they decline permissions.
If `[FBSDKAccessToken currentAccessToken]` is not nil, it will be treated as a reauthorization for that user
and will pass the "rerequest" flag to the login dialog.
This method will present UI the user. You typically should check if `[FBSDKAccessToken currentAccessToken]`
already contains the permissions you need before asking to reduce unnecessary app switching. For example,
you could make that check at viewDidLoad.
Expand All @@ -185,7 +179,7 @@ __attribute__ ((deprecated("use logInWithPublishPermissions:fromViewController:h
/*!
@method
@abstract Issues an asychronous renewCredentialsForAccount call to the device's Facebook account store.
@abstract Issues an asynchronous renewCredentialsForAccount call to the device's Facebook account store.
@param handler The completion handler to call when the renewal is completed. This can be invoked on an arbitrary thread.
Expand Down
Loading

0 comments on commit c570eae

Please sign in to comment.