diff --git a/Configurations/FacebookSDK-DynamicFramework.xcconfig b/Configurations/FacebookSDK-DynamicFramework.xcconfig index 1d467ce624..9f699a8754 100644 --- a/Configurations/FacebookSDK-DynamicFramework.xcconfig +++ b/Configurations/FacebookSDK-DynamicFramework.xcconfig @@ -27,6 +27,7 @@ CODE_SIGNING_REQUIRED = NO // Required for dynamic frameworks to properly emit bitcode ENABLE_BITCODE = YES FB_BITCODE_FLAG[sdk=iphoneos9.*] = +FB_BITCODE_FLAG[sdk=iphoneos10.*] = // Whether to strip out code that isn't called from anywhere DEAD_CODE_STRIPPING = NO diff --git a/Configurations/FacebookSDK-Project.xcconfig b/Configurations/FacebookSDK-Project.xcconfig index 893c4b8e9f..a0b26370b8 100644 --- a/Configurations/FacebookSDK-Project.xcconfig +++ b/Configurations/FacebookSDK-Project.xcconfig @@ -59,6 +59,7 @@ ENABLE_BITCODE = NO FB_BITCODE_FLAG = $() // Only specify bitcode for iphoneos. Specifying iphonesimulator breaks Xcode6 FB_BITCODE_FLAG[sdk=iphoneos9.*] = -fembed-bitcode +FB_BITCODE_FLAG[sdk=iphoneos10.*] = -fembed-bitcode OTHER_CFLAGS = $(inherited) $(FB_BITCODE_FLAG) // Warnings diff --git a/Configurations/Platform/iOS.xcconfig b/Configurations/Platform/iOS.xcconfig index 37ef240534..ae40fed4a7 100644 --- a/Configurations/Platform/iOS.xcconfig +++ b/Configurations/Platform/iOS.xcconfig @@ -32,4 +32,5 @@ ENABLE_BITCODE = NO FB_BITCODE_FLAG = $() // Only specify bitcode for iphoneos. Specifying iphonesimulator breaks Xcode 6 FB_BITCODE_FLAG[sdk=iphoneos9.*] = -fembed-bitcode +FB_BITCODE_FLAG[sdk=iphoneos10.*] = -fembed-bitcode OTHER_CFLAGS = $(inherited) $(FB_BITCODE_FLAG) diff --git a/Configurations/Target/DynamicFramework.xcconfig b/Configurations/Target/DynamicFramework.xcconfig index b2630e5da5..3e87ecdf0a 100644 --- a/Configurations/Target/DynamicFramework.xcconfig +++ b/Configurations/Target/DynamicFramework.xcconfig @@ -25,6 +25,7 @@ CODE_SIGN_IDENTITY = // Required for dynamic frameworks to properly emit bitcode ENABLE_BITCODE = YES FB_BITCODE_FLAG[sdk=iphoneos9.*] = +FB_BITCODE_FLAG[sdk=iphoneos10.*] = // Enables the framework to be included from any location as long as the // loader’s runpath search paths includes it. For example from an application diff --git a/Configurations/Version.xcconfig b/Configurations/Version.xcconfig index c50438eec5..6754725682 100644 --- a/Configurations/Version.xcconfig +++ b/Configurations/Version.xcconfig @@ -17,6 +17,6 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // The versions for FBSDK and Messenger SDK. -FBSDK_PROJECT_VERSION=4.15.0 +FBSDK_PROJECT_VERSION=4.15.1 MNSDK_PROJECT_VERSION=TODO_SUPPORT_MNSDK diff --git a/FBSDKCoreKit.podspec b/FBSDKCoreKit.podspec index 4882404abd..06fbebd596 100644 --- a/FBSDKCoreKit.podspec +++ b/FBSDKCoreKit.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.name = "FBSDKCoreKit" - s.version = "4.15.0" + s.version = "4.15.1" s.summary = "Official Facebook SDK for iOS to access Facebook Platform's core features" s.description = <<-DESC @@ -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.15.0" + :tag => "sdk-version-4.15.1" } s.ios.weak_frameworks = 'Accounts', 'CoreLocation', 'Social', 'Security', 'QuartzCore', 'CoreGraphics', 'UIKit', 'Foundation', 'AudioToolbox' diff --git a/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj b/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj index a0dabc5a46..33d511348a 100644 --- a/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj +++ b/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj @@ -193,7 +193,6 @@ 81B71D1F1D19C87400933E93 /* FBSDKError.m in Sources */ = {isa = PBXBuildFile; fileRef = 894C0B601A7150AC009137EF /* FBSDKError.m */; }; 81B71D201D19C87400933E93 /* FBSDKAccessTokenCacheV3_21.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DE1F3C81A89CEE600B54D98 /* FBSDKAccessTokenCacheV3_21.m */; }; 81B71D211D19C87400933E93 /* FBSDKTypeUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 894C0B6F1A717D60009137EF /* FBSDKTypeUtility.m */; }; - 81B71D221D19C87400933E93 /* FBSDKOrganicDeeplinkHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D69EFDF1CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.m */; }; 81B71D231D19C87400933E93 /* FBSDKAudioResourceLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D05AA81AA1134000609300 /* FBSDKAudioResourceLoader.m */; }; 81B71D241D19C87400933E93 /* FBSDKLogo.m in Sources */ = {isa = PBXBuildFile; fileRef = 893F44941A6444DF001DB0B6 /* FBSDKLogo.m */; }; 81B71D251D19C87400933E93 /* FBSDKPaymentObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D0BC14B1A8D236200BE8BA4 /* FBSDKPaymentObserver.m */; }; @@ -300,7 +299,6 @@ 81B71D8C1D19C87400933E93 /* FBSDKGraphRequestBody.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DC658A01A6EE7E200B85AAF /* FBSDKGraphRequestBody.h */; }; 81B71D8D1D19C87400933E93 /* FBSDKGraphRequestDataAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 896DE2321A9E509300195731 /* FBSDKGraphRequestDataAttachment.h */; settings = {ATTRIBUTES = (Public, ); }; }; 81B71D8E1D19C87400933E93 /* FBSDKAccessTokenCacheV3.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DE1F3BF1A89C57A00B54D98 /* FBSDKAccessTokenCacheV3.h */; }; - 81B71D8F1D19C87400933E93 /* FBSDKOrganicDeeplinkHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D69EFDE1CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.h */; }; 81B71D901D19C87400933E93 /* FBSDKSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DA8303A1A6999EC00770955 /* FBSDKSettings.h */; settings = {ATTRIBUTES = (Public, ); }; }; 81B71D911D19C87400933E93 /* FBSDKServerConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 89830F2D1A7805E100226ABB /* FBSDKServerConfiguration.h */; }; 81B71D921D19C87400933E93 /* FBSDKAppEventsStateManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D0BC15D1A8D428700BE8BA4 /* FBSDKAppEventsStateManager.h */; }; @@ -451,8 +449,6 @@ 9D6538411BF44FB4008A08E9 /* FBSDKViewImpressionTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 89688B611AA64C5E00A98519 /* FBSDKViewImpressionTracker.m */; }; 9D6999FE1A76E166003AE384 /* FBSDKLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D6999FC1A76E166003AE384 /* FBSDKLogger.h */; }; 9D6999FF1A76E166003AE384 /* FBSDKLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D6999FD1A76E166003AE384 /* FBSDKLogger.m */; }; - 9D69EFE01CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D69EFDE1CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.h */; }; - 9D69EFE11CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D69EFDF1CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.m */; }; 9D69FC4F1AA66BBF0068EC76 /* FBSDKGraphRequestConnection+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D69FC421AA66BBC0068EC76 /* FBSDKGraphRequestConnection+Internal.h */; }; 9D6DEEA91BC2368D001A94ED /* FBSDKAppEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D0BC1561A8D23E200BE8BA4 /* FBSDKAppEvents.m */; }; 9D6DEEAA1BC236B9001A94ED /* FBSDKAccessToken.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D3029091A65C4420086B9ED /* FBSDKAccessToken.m */; }; @@ -984,8 +980,6 @@ 9D641F8B1A7E0EA10048F563 /* FBSDKURLOpening.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBSDKURLOpening.h; sourceTree = ""; }; 9D6999FC1A76E166003AE384 /* FBSDKLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKLogger.h; sourceTree = ""; }; 9D6999FD1A76E166003AE384 /* FBSDKLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKLogger.m; sourceTree = ""; }; - 9D69EFDE1CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FBSDKOrganicDeeplinkHelper.h; path = AppLink/FBSDKOrganicDeeplinkHelper.h; sourceTree = ""; }; - 9D69EFDF1CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FBSDKOrganicDeeplinkHelper.m; path = AppLink/FBSDKOrganicDeeplinkHelper.m; sourceTree = ""; }; 9D69FC421AA66BBC0068EC76 /* FBSDKGraphRequestConnection+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FBSDKGraphRequestConnection+Internal.h"; sourceTree = ""; }; 9D7E7E5F1ADF038800F53E38 /* FBSDKTestUsersManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKTestUsersManager.h; sourceTree = ""; }; 9D7E7E601ADF038800F53E38 /* FBSDKTestUsersManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKTestUsersManager.m; sourceTree = ""; }; @@ -1141,8 +1135,6 @@ 7EB63D901A9BE720003A7AED /* AppLink */ = { isa = PBXGroup; children = ( - 9D69EFDE1CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.h */, - 9D69EFDF1CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.m */, 7EB63D9E1A9BE730003A7AED /* FBSDKBoltsMeasurementEventListener.h */, 7EB63D9D1A9BE730003A7AED /* FBSDKBoltsMeasurementEventListener.m */, ); @@ -1791,7 +1783,6 @@ 81B71D8C1D19C87400933E93 /* FBSDKGraphRequestBody.h in Headers */, 81B71D8D1D19C87400933E93 /* FBSDKGraphRequestDataAttachment.h in Headers */, 81B71D8E1D19C87400933E93 /* FBSDKAccessTokenCacheV3.h in Headers */, - 81B71D8F1D19C87400933E93 /* FBSDKOrganicDeeplinkHelper.h in Headers */, 81B71D901D19C87400933E93 /* FBSDKSettings.h in Headers */, 81B71D911D19C87400933E93 /* FBSDKServerConfiguration.h in Headers */, 81B71D921D19C87400933E93 /* FBSDKAppEventsStateManager.h in Headers */, @@ -1886,7 +1877,6 @@ 9DC658A51A6EE7E200B85AAF /* FBSDKGraphRequestBody.h in Headers */, 896DE2341A9E509300195731 /* FBSDKGraphRequestDataAttachment.h in Headers */, 9DE1F3C11A89C57A00B54D98 /* FBSDKAccessTokenCacheV3.h in Headers */, - 9D69EFE01CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.h in Headers */, 9DA8303C1A6999EC00770955 /* FBSDKSettings.h in Headers */, 89830F2F1A7805E100226ABB /* FBSDKServerConfiguration.h in Headers */, 9D0BC15F1A8D428700BE8BA4 /* FBSDKAppEventsStateManager.h in Headers */, @@ -2470,7 +2460,6 @@ 81B71D1F1D19C87400933E93 /* FBSDKError.m in Sources */, 81B71D201D19C87400933E93 /* FBSDKAccessTokenCacheV3_21.m in Sources */, 81B71D211D19C87400933E93 /* FBSDKTypeUtility.m in Sources */, - 81B71D221D19C87400933E93 /* FBSDKOrganicDeeplinkHelper.m in Sources */, 81B71D231D19C87400933E93 /* FBSDKAudioResourceLoader.m in Sources */, 81B71D241D19C87400933E93 /* FBSDKLogo.m in Sources */, 81B71D251D19C87400933E93 /* FBSDKPaymentObserver.m in Sources */, @@ -2547,7 +2536,6 @@ 894C0B621A7150AC009137EF /* FBSDKError.m in Sources */, 9DE1F3CA1A89CEE600B54D98 /* FBSDKAccessTokenCacheV3_21.m in Sources */, 894C0B711A717D60009137EF /* FBSDKTypeUtility.m in Sources */, - 9D69EFE11CAC74FE00CF5A73 /* FBSDKOrganicDeeplinkHelper.m in Sources */, 89D05AAA1AA1134000609300 /* FBSDKAudioResourceLoader.m in Sources */, 893F449A1A6444DF001DB0B6 /* FBSDKLogo.m in Sources */, 9D0BC1501A8D236200BE8BA4 /* FBSDKPaymentObserver.m in Sources */, diff --git a/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.h b/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.h index 9892667bae..32538ac3f4 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.h +++ b/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.h @@ -61,24 +61,10 @@ typedef void (^FBSDKDeferredAppInviteHandler)(NSURL *url); + (void)fetchDeferredAppLink:(FBSDKDeferredAppLinkHandler)handler; /*! - @abstract Call this method from the main thread to fetch deferred deeplink for App Invites - Handler is called with deeplink url, if found, nil otherwise. - - @param handler Handler to be called when we fetch deeplink url. - - @return YES if async fetch process was started, NO if it failed to start. Note it returns NO - for versions < iOS 9. - - @discussion Call this method from the main thread to fetch deferred deeplink if you use App Invites. - This may require a network round trip. If successful, this will call the handler provided, with - deferred deeplink that was clicked by the user. If there is a error/timeout, handler will be called - with nil. - This method only works on iOS 9+ and returns NO otherwise. - This method should only be called from a location that occurs after any launching URL has - been processed (e.g., you should call this method from your application delegate's - didFinishLaunchingWithOptions:). + @deprecated This method is no longer available and will always return NO. */ -+ (BOOL)fetchDeferredAppInvite:(FBSDKDeferredAppInviteHandler)handler; ++ (BOOL)fetchDeferredAppInvite:(FBSDKDeferredAppInviteHandler)handler +__attribute__((deprecated("This method is no longer available.")));; /* @abstract Call this method to fetch promotion code from the url, if it's present. This function diff --git a/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.m b/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.m index 14bf70b345..6def9e4deb 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.m +++ b/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.m @@ -23,7 +23,6 @@ #import "FBSDKAppEventsUtility.h" #import "FBSDKGraphRequest.h" #import "FBSDKInternalUtility.h" -#import "FBSDKOrganicDeeplinkHelper.h" #import "FBSDKSettings.h" #import "FBSDKUtility.h" @@ -83,12 +82,7 @@ + (void)fetchDeferredAppLink:(FBSDKDeferredAppLinkHandler)handler + (BOOL)fetchDeferredAppInvite:(FBSDKDeferredAppInviteHandler)handler { - NSAssert([NSThread isMainThread], @"FBSDKAppLink fetchOrganicDeferredAppLink: must be invoked from main thread."); - - NSAssert(handler, @"FBSDKAppLink fetchOrganicDeferredAppLink: must be invoked with valid handler."); - - FBSDKOrganicDeeplinkHelper *deeplinkHelper = [[FBSDKOrganicDeeplinkHelper alloc] init]; - return [deeplinkHelper fetchOrganicDeeplink:handler]; + return NO; } + (NSString*)appInvitePromotionCodeFromURL:(NSURL*)url; diff --git a/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m b/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m index ac2905c32b..9310bb857f 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m +++ b/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m @@ -39,7 +39,6 @@ #import "FBSDKBridgeAPIResponse.h" #import "FBSDKContainerViewController.h" #import "FBSDKProfile+Internal.h" -#import "FBSDKOrganicDeeplinkHelper.h" #endif NSString *const FBSDKApplicationDidBecomeActiveNotification = @"com.facebook.sdk.FBSDKApplicationDidBecomeActiveNotification"; @@ -136,34 +135,6 @@ - (BOOL)application:(UIApplication *)application [FBSDKTimeSpentData setSourceApplication:sourceApplication openURL:url]; #if !TARGET_OS_TV - if (_organicDeeplinkHandler) { - NSDictionary *params = [FBSDKUtility dictionaryWithQueryString:url.query]; - if([params[@"fbsdk_deeplink"] isEqualToString: @"1"]) { - - NSURL *sanitizedUrl = nil; - - if(![params[@"fbsdk_deeplink_exception"] isEqualToString:@"1"]) { - - NSMutableDictionary *sanitizedParams = [NSMutableDictionary dictionaryWithDictionary:params]; - [sanitizedParams removeObjectForKey:@"fbsdk_deeplink"]; - sanitizedUrl = [FBSDKInternalUtility URLWithScheme:url.scheme - host:url.host - path:url.path - queryParameters:sanitizedParams - error:nil]; - } - // copy the _organicDeeplinkHandler here because it can get cleared in FBSDKOrganicDeeplinkHelper - // so that we avoid bad_exc_access in the dispatch_async below. - FBSDKDeferredAppInviteHandler appInviteHandler = [_organicDeeplinkHandler copy]; - _organicDeeplinkHandler = nil; - dispatch_async(dispatch_get_main_queue(), ^{ - appInviteHandler(sanitizedUrl); - }); - - return YES; - } - } - // if they completed a SFVC flow, dismiss it. [_safariViewController.presentingViewController dismissViewControllerAnimated:YES completion: nil]; _safariViewController = nil; diff --git a/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h b/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h index ff2c41d102..4b122f8cb9 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h +++ b/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h @@ -44,5 +44,5 @@ #import #endif -#define FBSDK_VERSION_STRING @"4.15.0" +#define FBSDK_VERSION_STRING @"4.15.1" #define FBSDK_TARGET_PLATFORM_VERSION @"v2.7" diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/AppLink/FBSDKOrganicDeeplinkHelper.h b/FBSDKCoreKit/FBSDKCoreKit/Internal/AppLink/FBSDKOrganicDeeplinkHelper.h deleted file mode 100644 index 5d61544ccf..0000000000 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/AppLink/FBSDKOrganicDeeplinkHelper.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// -// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, -// copy, modify, and distribute this software in source code or binary form for use -// in connection with the web services and APIs provided by Facebook. -// -// As with any software that integrates with the Facebook platform, your use of -// this software is subject to the Facebook Developer Principles and Policies -// [http://developers.facebook.com/policy/]. This copyright notice shall be -// included in all copies or substantial portions of the software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// 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. - -#import - -#import - -@interface FBSDKOrganicDeeplinkHelper: NSObject -- (bool)fetchOrganicDeeplink:(FBSDKDeferredAppInviteHandler)handler; -@end diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/AppLink/FBSDKOrganicDeeplinkHelper.m b/FBSDKCoreKit/FBSDKCoreKit/Internal/AppLink/FBSDKOrganicDeeplinkHelper.m deleted file mode 100644 index b0b5dbce0c..0000000000 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/AppLink/FBSDKOrganicDeeplinkHelper.m +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// -// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, -// copy, modify, and distribute this software in source code or binary form for use -// in connection with the web services and APIs provided by Facebook. -// -// As with any software that integrates with the Facebook platform, your use of -// this software is subject to the Facebook Developer Principles and Policies -// [http://developers.facebook.com/policy/]. This copyright notice shall be -// included in all copies or substantial portions of the software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// 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. - -#import "FBSDKOrganicDeeplinkHelper.h" - -#import -#import -#import - -#import "FBSDKApplicationDelegate+Internal.h" -#import "FBSDKDynamicFrameworkLoader.h" -#import "FBSDKInternalUtility.h" -#import "FBSDKSettings.h" - - -@interface FBSDKOrganicDeeplinkHelper () < -SFSafariViewControllerDelegate -> -@end - -@implementation FBSDKOrganicDeeplinkHelper { - UIWindow *_safariWindow; - UIViewController *_safariViewController; - FBSDKDeferredAppInviteHandler _handler; -} - -- (bool)fetchOrganicDeeplink:(FBSDKDeferredAppInviteHandler) handler -{ - _handler = handler; - - // trying to dynamically load SFSafariViewController class - // so for the cases when it is available we can send users through Safari View Controller flow - // in cases it is not available regular flow will be selected - Class SFSafariViewControllerClass = fbsdkdfl_SFSafariViewControllerClass(); - if(!SFSafariViewControllerClass) { - return NO; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - [FBSDKApplicationDelegate sharedInstance].organicDeeplinkHandler = handler; - [self presentSafariViewController]; - - // Dispatch a fallback handler call, if we get no response within 10 seconds. - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - if([FBSDKApplicationDelegate sharedInstance].organicDeeplinkHandler) - { - [self cleanUpSafariViewController]; - [FBSDKApplicationDelegate sharedInstance].organicDeeplinkHandler = nil; - _handler(nil); - } - }); - }); - - return YES; -} - -- (void)presentSafariViewController -{ - Class SFSafariViewControllerClass = fbsdkdfl_SFSafariViewControllerClass(); - _safariViewController = [[SFSafariViewControllerClass alloc] initWithURL: [self constructDeeplinkRetrievalUrl]]; - _safariViewController.view.userInteractionEnabled = NO; - [_safariViewController performSelector:@selector(setDelegate:) withObject:self]; - - _safariWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 1, 1)]; - _safariWindow.windowLevel -= 1000; - _safariWindow.rootViewController = _safariViewController; - _safariWindow.hidden = NO; - [_safariWindow makeKeyAndVisible]; -} - -- (void)cleanUpSafariViewController -{ - if (_safariViewController) - { - [_safariViewController performSelector:@selector(setDelegate:) withObject:nil]; - _safariViewController = nil; - _safariWindow.rootViewController = nil; - _safariWindow = nil; - } -} - -- (NSURL*)constructDeeplinkRetrievalUrl -{ - NSString *appID = [FBSDKSettings appID]; - UIDevice* device = [UIDevice currentDevice]; - NSString* deviceName = @"default"; - - switch (device.userInterfaceIdiom) { - case UIUserInterfaceIdiomPad: - deviceName = @"ipad"; - break; - - case UIUserInterfaceIdiomPhone: - deviceName = @"iphone"; - break; - - case UIUserInterfaceIdiomTV: - deviceName = @"tvos"; - break; - -#if __IPHONE_9_3 - case UIUserInterfaceIdiomCarPlay: -#endif - case UIUserInterfaceIdiomUnspecified: - deviceName = @"unspecified"; - break; - } - - NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init]; - parameters[@"application_id"] = appID; - parameters[@"device"] = deviceName; - return [FBSDKInternalUtility facebookURLWithHostPrefix:@"m" - path:@"/deferreddeeplink/retrieve/" - queryParameters:parameters - defaultVersion: @"" - error:nil]; -} - -#pragma mark - SFSafariViewControllerDelegate -- (void)safariViewController:(SFSafariViewController *)controller didCompleteInitialLoad:(BOOL)didLoadSuccessfully -{ - // Mark request as complete, Safari would redirect to url with correct deeplink or default uri. - [self cleanUpSafariViewController]; -} - -@end diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKApplicationDelegate+Internal.h b/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKApplicationDelegate+Internal.h index 0ac65ec81c..9e3e606953 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKApplicationDelegate+Internal.h +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKApplicationDelegate+Internal.h @@ -47,7 +47,6 @@ typedef void(^FBSDKBridgeAPICallbackBlock)(FBSDKBridgeAPIResponse *response); - (void)openURL:(NSURL *)url sender:(id)sender handler:(void(^)(BOOL))handler; -@property (nonatomic, copy) FBSDKDeferredAppInviteHandler organicDeeplinkHandler; #endif @property (nonatomic, readonly, getter=isActive) BOOL active; diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfiguration.h b/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfiguration.h index 71cc5a0ec3..675a4cf477 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfiguration.h +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfiguration.h @@ -52,6 +52,7 @@ implicitPurchaseLoggingEnabled:(BOOL)implicitPurchaseLoggingEnabled errorConfiguration:(FBSDKErrorConfiguration *)errorConfiguration sessionTimeoutInterval:(NSTimeInterval) sessionTimeoutInterval defaults:(BOOL)defaults + loggingToken:(NSString *)loggingToken NS_DESIGNATED_INITIALIZER; @property (nonatomic, assign, readonly, getter=isAdvertisingIDEnabled) BOOL advertisingIDEnabled; @@ -68,6 +69,7 @@ NS_DESIGNATED_INITIALIZER; @property (nonatomic, copy, readonly) NSString *loginTooltipText; @property (nonatomic, copy, readonly) NSDate *timestamp; @property (nonatomic, assign) NSTimeInterval sessionTimoutInterval; +@property (nonatomic, copy, readonly) NSString *loggingToken; - (FBSDKDialogConfiguration *)dialogConfigurationForDialogName:(NSString *)dialogName; - (BOOL)useNativeDialogForDialogName:(NSString *)dialogName; diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfiguration.m b/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfiguration.m index 4beea68f01..d033ab4283 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfiguration.m +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfiguration.m @@ -37,6 +37,7 @@ #define FBSDK_SERVER_CONFIGURATION_NATIVE_AUTH_FLOW_ENABLED_KEY @"nativeAuthFlowEnabled" #define FBSDK_SERVER_CONFIGURATION_TIMESTAMP_KEY @"timestamp" #define FBSDK_SERVER_CONFIGURATION_SESSION_TIMEOUT_INTERVAL @"sessionTimeoutInterval" +#define FBSDK_SERVER_CONFIGURATION_LOGGING_TOKEN @"loggingToken" #pragma mark - Dialog Names @@ -85,6 +86,7 @@ - (instancetype)initWithAppID:(NSString *)appID errorConfiguration:(FBSDKErrorConfiguration *)errorConfiguration sessionTimeoutInterval:(NSTimeInterval) sessionTimeoutInterval defaults:(BOOL)defaults + loggingToken:(NSString *)loggingToken { if ((self = [super init])) { _appID = [appID copy]; @@ -103,6 +105,7 @@ - (instancetype)initWithAppID:(NSString *)appID _errorConfiguration = [errorConfiguration copy]; _sessionTimoutInterval = sessionTimeoutInterval; _defaults = defaults; + _loggingToken = loggingToken; } return self; } @@ -177,6 +180,7 @@ - (id)initWithCoder:(NSCoder *)decoder forKey:FBSDK_SERVER_CONFIGURATION_DIALOG_FLOWS_KEY]; FBSDKErrorConfiguration *errorConfiguration = [decoder decodeObjectOfClass:[FBSDKErrorConfiguration class] forKey:FBSDK_SERVER_CONFIGURATION_ERROR_CONFIGS_KEY]; NSTimeInterval sessionTimeoutInterval = [decoder decodeDoubleForKey:FBSDK_SERVER_CONFIGURATION_SESSION_TIMEOUT_INTERVAL]; + NSString *loggingToken = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SERVER_CONFIGURATION_LOGGING_TOKEN]; return [self initWithAppID:appID appName:appName loginTooltipEnabled:loginTooltipEnabled @@ -192,7 +196,8 @@ - (id)initWithCoder:(NSCoder *)decoder timestamp:timestamp errorConfiguration:errorConfiguration sessionTimeoutInterval:sessionTimeoutInterval - defaults:NO]; + defaults:NO + loggingToken:loggingToken]; } - (void)encodeWithCoder:(NSCoder *)encoder @@ -213,6 +218,7 @@ - (void)encodeWithCoder:(NSCoder *)encoder [encoder encodeBool:_systemAuthenticationEnabled forKey:FBSDK_SERVER_CONFIGURATION_SYSTEM_AUTHENTICATION_ENABLED_KEY]; [encoder encodeObject:_timestamp forKey:FBSDK_SERVER_CONFIGURATION_TIMESTAMP_KEY]; [encoder encodeDouble:_sessionTimoutInterval forKey:FBSDK_SERVER_CONFIGURATION_SESSION_TIMEOUT_INTERVAL]; + [encoder encodeObject:_loggingToken forKey:FBSDK_SERVER_CONFIGURATION_LOGGING_TOKEN]; } #pragma mark - NSCopying diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfigurationManager.m b/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfigurationManager.m index 55b352f501..d7d49c9b27 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfigurationManager.m +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfigurationManager.m @@ -45,6 +45,7 @@ #define FBSDK_SERVER_CONFIGURATION_NATIVE_PROXY_AUTH_FLOW_ENABLED_FIELD @"ios_supports_native_proxy_auth_flow" #define FBSDK_SERVER_CONFIGURATION_SYSTEM_AUTHENTICATION_ENABLED_FIELD @"ios_supports_system_auth" #define FBSDK_SERVER_CONFIGURATION_SESSION_TIMEOUT_FIELD @"app_events_session_timeout" +#define FBSDK_SERVER_CONFIGURATION_LOGGIN_TOKEN_FIELD @"logging_token" @implementation FBSDKServerConfigurationManager @@ -181,6 +182,7 @@ + (void)processLoadRequestResponse:(id)result error:(NSError *)error appID:(NSSt FBSDKErrorConfiguration *errorConfiguration = [[FBSDKErrorConfiguration alloc] initWithDictionary:nil]; [errorConfiguration parseArray:resultDictionary[FBSDK_SERVER_CONFIGURATION_ERROR_CONFIGURATION_FIELD]]; NSTimeInterval sessionTimeoutInterval = [FBSDKTypeUtility timeIntervalValue:resultDictionary[FBSDK_SERVER_CONFIGURATION_SESSION_TIMEOUT_FIELD]] ?: DEFAULT_SESSION_TIMEOUT_INTERVAL; + NSString *loggingToken = [FBSDKTypeUtility stringValue:resultDictionary[FBSDK_SERVER_CONFIGURATION_LOGGIN_TOKEN_FIELD]]; FBSDKServerConfiguration *serverConfiguration = [[FBSDKServerConfiguration alloc] initWithAppID:appID appName:appName loginTooltipEnabled:loginTooltipEnabled @@ -196,7 +198,8 @@ + (void)processLoadRequestResponse:(id)result error:(NSError *)error appID:(NSSt timestamp:[NSDate date] errorConfiguration:errorConfiguration sessionTimeoutInterval:sessionTimeoutInterval - defaults:NO]; + defaults:NO + loggingToken:loggingToken]; [self _didProcessConfigurationFromNetwork:serverConfiguration appID:appID error:nil]; } @@ -220,6 +223,7 @@ + (FBSDKGraphRequest *)requestToLoadServerConfiguration:(NSString *)appID FBSDK_SERVER_CONFIGURATION_NATIVE_PROXY_AUTH_FLOW_ENABLED_FIELD, FBSDK_SERVER_CONFIGURATION_SYSTEM_AUTHENTICATION_ENABLED_FIELD, FBSDK_SERVER_CONFIGURATION_SESSION_TIMEOUT_FIELD, + FBSDK_SERVER_CONFIGURATION_LOGGIN_TOKEN_FIELD, ]; NSDictionary *parameters = @{ @"fields": [fields componentsJoinedByString:@","] }; FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:appID @@ -268,7 +272,8 @@ + (FBSDKServerConfiguration *)_defaultServerConfigurationForAppID:(NSString *)ap timestamp:nil errorConfiguration:nil sessionTimeoutInterval:DEFAULT_SESSION_TIMEOUT_INTERVAL - defaults:YES]; + defaults:YES + loggingToken:nil]; } return _defaultServerConfiguration; } diff --git a/FBSDKLoginKit.podspec b/FBSDKLoginKit.podspec index bd88fbad95..5b0cc7fbcc 100644 --- a/FBSDKLoginKit.podspec +++ b/FBSDKLoginKit.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.name = "FBSDKLoginKit" - s.version = "4.15.0" + s.version = "4.15.1" 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 @@ -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.15.0" + :tag => "sdk-version-4.15.1" } s.weak_frameworks = "Accounts", "CoreLocation", "Social", "Security", "QuartzCore", "CoreGraphics", "UIKit", "Foundation", "AudioToolbox" diff --git a/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.m b/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.m index 8880391dad..6a630870e5 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.m +++ b/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.m @@ -283,7 +283,7 @@ - (NSString *)loadExpectedChallenge return [_keychainStore stringForKey:FBSDKExpectedChallengeKey]; } -- (NSDictionary *)logInParametersWithPermissions:(NSSet *)permissions +- (NSDictionary *)logInParametersWithPermissions:(NSSet *)permissions serverConfiguration:(FBSDKServerConfiguration *)serverConfiguration { [FBSDKInternalUtility validateURLSchemes]; @@ -297,6 +297,7 @@ - (NSDictionary *)logInParametersWithPermissions:(NSSet *)permissions loginParams[@"sdk_version"] = FBSDK_VERSION_STRING; loginParams[@"fbapp_pres"] = @([FBSDKInternalUtility isFacebookAppInstalled]); loginParams[@"auth_type"] = @"rerequest"; + loginParams[@"logging_token"] = serverConfiguration.loggingToken; [FBSDKInternalUtility dictionary:loginParams setObject:[FBSDKSettings appURLSchemeSuffix] forKey:@"local_client_id"]; [FBSDKInternalUtility dictionary:loginParams setObject:[FBSDKLoginUtility stringForAudience:self.defaultAudience] forKey:@"default_audience"]; @@ -325,7 +326,15 @@ - (void)logInWithPermissions:(NSSet *)permissions handler:(FBSDKLoginManagerRequ - (void)logInWithBehavior:(FBSDKLoginBehavior)loginBehavior { - NSDictionary *loginParams = [self logInParametersWithPermissions:_requestedPermissions]; + __weak __typeof__(self) weakSelf = self; + [FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:^(FBSDKServerConfiguration *serverConfiguration, NSError *loadError) { + [weakSelf logInWithBehavior:loginBehavior serverConfiguration:serverConfiguration serverConfigurationLoadError:loadError]; + }]; +} + +- (void)logInWithBehavior:(FBSDKLoginBehavior)loginBehavior serverConfiguration:(FBSDKServerConfiguration *)serverConfiguration serverConfigurationLoadError:(NSError *)loadError +{ + NSDictionary *loginParams = [self logInParametersWithPermissions:_requestedPermissions serverConfiguration:serverConfiguration]; void(^completion)(BOOL, NSString *, NSError *) = ^void(BOOL didPerformLogIn, NSString *authMethod, NSError *error) { if (didPerformLogIn) { @@ -342,24 +351,22 @@ - (void)logInWithBehavior:(FBSDKLoginBehavior)loginBehavior switch (loginBehavior) { case FBSDKLoginBehaviorNative: { if ([FBSDKInternalUtility isFacebookAppInstalled]) { - [FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:^(FBSDKServerConfiguration *serverConfiguration, NSError *loadError) { - BOOL useNativeDialog = [serverConfiguration useNativeDialogForDialogName:FBSDKDialogConfigurationNameLogin]; - if (useNativeDialog && loadError == nil) { - [self performNativeLogInWithParameters:loginParams handler:^(BOOL openedURL, NSError *openedURLError) { - if (openedURLError) { - [FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors - formatString:@"FBSDKLoginBehaviorNative failed : %@\nTrying FBSDKLoginBehaviorBrowser", openedURLError]; - } - if (openedURL) { - completion(YES, FBSDKLoginManagerLoggerAuthMethod_Native, openedURLError); - } else { - [self logInWithBehavior:FBSDKLoginBehaviorBrowser]; - } - }]; - } else { - [self logInWithBehavior:FBSDKLoginBehaviorBrowser]; - } - }]; + BOOL useNativeDialog = [serverConfiguration useNativeDialogForDialogName:FBSDKDialogConfigurationNameLogin]; + if (useNativeDialog && loadError == nil) { + [self performNativeLogInWithParameters:loginParams handler:^(BOOL openedURL, NSError *openedURLError) { + if (openedURLError) { + [FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors + formatString:@"FBSDKLoginBehaviorNative failed : %@\nTrying FBSDKLoginBehaviorBrowser", openedURLError]; + } + if (openedURL) { + completion(YES, FBSDKLoginManagerLoggerAuthMethod_Native, openedURLError); + } else { + [self logInWithBehavior:FBSDKLoginBehaviorBrowser]; + } + }]; + } else { + [self logInWithBehavior:FBSDKLoginBehaviorBrowser]; + } break; } // intentional fall through. @@ -373,13 +380,11 @@ - (void)logInWithBehavior:(FBSDKLoginBehavior)loginBehavior break; } case FBSDKLoginBehaviorSystemAccount: { - [FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:^(FBSDKServerConfiguration *serverConfiguration, NSError *loadError) { - if (serverConfiguration.isSystemAuthenticationEnabled && loadError == nil) { - [self beginSystemLogIn]; - } else { - [self logInWithBehavior:FBSDKLoginBehaviorNative]; - } - }]; + if (serverConfiguration.isSystemAuthenticationEnabled && loadError == nil) { + [self beginSystemLogIn]; + } else { + [self logInWithBehavior:FBSDKLoginBehaviorNative]; + } completion(YES, FBSDKLoginManagerLoggerAuthMethod_System, nil); break; } diff --git a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManager+Internal.h b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManager+Internal.h index 344e14f532..7608b40e0c 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManager+Internal.h +++ b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManager+Internal.h @@ -42,7 +42,7 @@ - (void)logInWithBehavior:(FBSDKLoginBehavior)loginBehavior; // made available for testing only -- (NSDictionary *)logInParametersWithPermissions:(NSSet *)permissions; +- (NSDictionary *)logInParametersWithPermissions:(NSSet *)permissions serverConfiguration:(FBSDKServerConfiguration *)serverConfiguration; // made available for testing only - (void)validateReauthentication:(FBSDKAccessToken *)currentToken withResult:(FBSDKLoginManagerLoginResult *)loginResult; diff --git a/FBSDKLoginKit/FBSDKLoginKitTests/FBSDKSystemAccountAuthenticationTests.m b/FBSDKLoginKit/FBSDKLoginKitTests/FBSDKSystemAccountAuthenticationTests.m index a7b384cb3f..9ac123744d 100644 --- a/FBSDKLoginKit/FBSDKLoginKitTests/FBSDKSystemAccountAuthenticationTests.m +++ b/FBSDKLoginKit/FBSDKLoginKitTests/FBSDKSystemAccountAuthenticationTests.m @@ -226,7 +226,8 @@ - (void)testSystemAccountNotAvailableTriesNextAuthMethodServer:(BOOL)serverSuppo timestamp:[NSDate date] errorConfiguration:nil sessionTimeoutInterval:60.0 - defaults:NO]; + defaults:NO + loggingToken:nil]; id serverConfigurationManager = [OCMockObject mockForClass:[FBSDKServerConfigurationManager class]]; [[[serverConfigurationManager stub] andReturn:serverConfiguration] cachedServerConfiguration]; [[[serverConfigurationManager stub] andDo:^(NSInvocation *invocation) { diff --git a/FBSDKMessengerShareKit/Configurations/FacebookSDK-Project.xcconfig b/FBSDKMessengerShareKit/Configurations/FacebookSDK-Project.xcconfig index 2ddf173157..b0765d0fcc 100644 --- a/FBSDKMessengerShareKit/Configurations/FacebookSDK-Project.xcconfig +++ b/FBSDKMessengerShareKit/Configurations/FacebookSDK-Project.xcconfig @@ -58,6 +58,7 @@ CLANG_CXX_LIBRARY = libc++ ENABLE_BITCODE = NO FB_BITCODE_FLAG = $() FB_BITCODE_FLAG[sdk=iphoneos9.*] = -fembed-bitcode +FB_BITCODE_FLAG[sdk=iphoneos10.*] = -fembed-bitcode OTHER_CFLAGS = $(inherited) $(FB_BITCODE_FLAG) diff --git a/FBSDKShareKit.podspec b/FBSDKShareKit.podspec index 6a7f1c2038..655e7b45c5 100644 --- a/FBSDKShareKit.podspec +++ b/FBSDKShareKit.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.name = "FBSDKShareKit" - s.version = "4.15.0" + s.version = "4.15.1" s.summary = "Official Facebook SDK for iOS to access Facebook Platform's Sharing Features" s.description = <<-DESC @@ -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.15.0" + :tag => "sdk-version-4.15.1" } s.ios.weak_frameworks = 'Accounts', 'AudioToolbox', 'CoreGraphics', 'CoreLocation', 'Foundation', 'QuartzCore', 'Security', 'Social', 'UIKit' diff --git a/FBSDKTVOSKit.podspec b/FBSDKTVOSKit.podspec index 29b735d21d..5dd03a6008 100644 --- a/FBSDKTVOSKit.podspec +++ b/FBSDKTVOSKit.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.name = 'FBSDKTVOSKit' - s.version = '4.15.0' + s.version = '4.15.1' s.summary = 'Official Facebook SDK for tvOS to access Facebook Platform with features like Login and Graph API.' s.description = <<-DESC @@ -20,7 +20,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.15.0' } + :tag => 'sdk-version-4.15.1' } s.source_files = 'FBSDKTVOSKit/FBSDKTVOSKit/**/*.{h,m}' s.public_header_files = 'FBSDKTVOSKit/FBSDKTVOSKit/*.h' diff --git a/samples/HelloTV/HelloTV.xcodeproj/project.pbxproj b/samples/HelloTV/HelloTV.xcodeproj/project.pbxproj index 30288db9fa..7d6dfca2ec 100644 --- a/samples/HelloTV/HelloTV.xcodeproj/project.pbxproj +++ b/samples/HelloTV/HelloTV.xcodeproj/project.pbxproj @@ -157,6 +157,7 @@ TargetAttributes = { 9D81FDAD1C5048A900AF5F8D = { CreatedOnToolsVersion = 7.2; + LastSwiftMigration = 0800; }; }; }; @@ -304,6 +305,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 9D81FDD11C504A0000AF5F8D /* Application-TVOS.xcconfig */; buildSettings = { + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -311,6 +313,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 9D81FDD11C504A0000AF5F8D /* Application-TVOS.xcconfig */; buildSettings = { + SWIFT_VERSION = 3.0; }; name = Release; }; diff --git a/samples/HelloTV/HelloTV/AppDelegate.swift b/samples/HelloTV/HelloTV/AppDelegate.swift index b97bd260b6..b2673cb6c4 100644 --- a/samples/HelloTV/HelloTV/AppDelegate.swift +++ b/samples/HelloTV/HelloTV/AppDelegate.swift @@ -25,15 +25,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { - FBSDKDeviceLoginButton.self + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { FBSDKApplicationDelegate.sharedInstance().application( application, didFinishLaunchingWithOptions: launchOptions) return true } - func applicationDidBecomeActive(application: UIApplication) { + func applicationDidBecomeActive(_ application: UIApplication) { FBSDKAppEvents.activateApp() } } diff --git a/samples/HelloTV/HelloTV/FirstViewController.swift b/samples/HelloTV/HelloTV/FirstViewController.swift index edd2daabae..e406a885b7 100644 --- a/samples/HelloTV/HelloTV/FirstViewController.swift +++ b/samples/HelloTV/HelloTV/FirstViewController.swift @@ -21,11 +21,11 @@ import FBSDKShareKit import FBSDKTVOSKit class FirstViewController: UIViewController { - @IBOutlet private weak var imageView: UIImageView? - @IBOutlet private weak var loginButton: FBSDKDeviceLoginButton? - @IBOutlet private weak var shareButton: FBSDKDeviceShareButton? + @IBOutlet fileprivate weak var imageView: UIImageView? + @IBOutlet fileprivate weak var loginButton: FBSDKDeviceLoginButton? + @IBOutlet fileprivate weak var shareButton: FBSDKDeviceShareButton? - private var blankImage: UIImage? + fileprivate var blankImage: UIImage? override func viewDidLoad() { super.viewDidLoad() @@ -34,40 +34,40 @@ class FirstViewController: UIViewController { blankImage = imageView?.image // Subscribe to FB session changes (in case they logged in or out in the second tab) - NSNotificationCenter.defaultCenter().addObserverForName( - FBSDKAccessTokenDidChangeNotification, + NotificationCenter.default.addObserver( + forName: .FBSDKAccessTokenDidChange, object: nil, - queue: NSOperationQueue.mainQueue()) { (notification) -> Void in + queue: .main) { (notification) -> Void in self.updateContent() } // If the user is already logged in. - if FBSDKAccessToken.currentAccessToken() != nil { + if FBSDKAccessToken.current() != nil { updateContent() } let linkContent = FBSDKShareLinkContent() - linkContent.contentURL = NSURL(string: "https://developers.facebook.com/docs/tvos") + linkContent.contentURL = URL(string: "https://developers.facebook.com/docs/tvos") linkContent.contentDescription = "Let's build a tvOS app with Facebook!" shareButton?.shareContent = linkContent } - private func flipImageViewToImage(image: UIImage?) { + fileprivate func flipImageViewToImage(_ image: UIImage?) { guard let imageView = imageView else { return } - UIView.transitionWithView(imageView, - duration: 1, - options:.TransitionCrossDissolve, - animations: { () -> Void in - self.imageView?.image = image + UIView.transition(with: imageView, + duration: 1, + options:.transitionCrossDissolve, + animations: { () -> Void in + self.imageView?.image = image }, completion: nil) } - private func updateContent() { + fileprivate func updateContent() { guard let imageView = imageView else { return } - guard FBSDKAccessToken.currentAccessToken() != nil else { + guard FBSDKAccessToken.current() != nil else { imageView.image = blankImage return } @@ -78,36 +78,37 @@ class FirstViewController: UIViewController { format: "https://graph.facebook.com/v2.5/me/picture?type=square&width=%d&height=%d&access_token=%@", Int(imageView.bounds.size.width), Int(imageView.bounds.size.height), - FBSDKAccessToken.currentAccessToken().tokenString) + FBSDKAccessToken.current().tokenString) - let url = NSURL(string: urlString) - let userImage = UIImage(data: NSData(contentsOfURL: url!)!) + let url = URL(string: urlString) + let userImage = UIImage(data: try! Data(contentsOf: url!)) flipImageViewToImage(userImage!) } } extension FirstViewController: FBSDKDeviceLoginButtonDelegate { - func deviceLoginButtonDidCancel(button: FBSDKDeviceLoginButton) { + func deviceLoginButtonDidCancel(_ button: FBSDKDeviceLoginButton) { print("Login cancelled") } - func deviceLoginButtonDidLogIn(button: FBSDKDeviceLoginButton) { + func deviceLoginButtonDidLog(in button: FBSDKDeviceLoginButton) { print("Login complete") updateContent() } - func deviceLoginButtonDidLogOut(button: FBSDKDeviceLoginButton) { + func deviceLoginButtonDidLogOut(_ button: FBSDKDeviceLoginButton) { print("Logout complete") flipImageViewToImage(blankImage) } - func deviceLoginButtonDidFail(button: FBSDKDeviceLoginButton, error: NSError) { + public func deviceLoginButtonDidFail(_ button: FBSDKDeviceLoginButton, error: Error) { print("Login error : ", error) } } extension FirstViewController: FBSDKDeviceShareViewControllerDelegate { - func deviceShareViewControllerDidComplete(viewController: FBSDKDeviceShareViewController, error: NSError?) { + + public func deviceShareViewControllerDidComplete(_ viewController: FBSDKDeviceShareViewController, error: Error?) { print("Device share finished with error?", error) } } diff --git a/samples/HelloTV/HelloTV/SecondViewController.swift b/samples/HelloTV/HelloTV/SecondViewController.swift index bf4cb2bc06..d8949252b3 100644 --- a/samples/HelloTV/HelloTV/SecondViewController.swift +++ b/samples/HelloTV/HelloTV/SecondViewController.swift @@ -33,23 +33,23 @@ class SecondViewController: UIViewController { // Subscribe to FB session changes (in case they logged in or out in the first tab) // and dispatch similar events to our TVJS. This would not be necessary for pure // TVML apps. - NSNotificationCenter.defaultCenter().addObserverForName( - FBSDKAccessTokenDidChangeNotification, + NotificationCenter.default.addObserver( + forName: NSNotification.Name.FBSDKAccessTokenDidChange, object: nil, - queue: NSOperationQueue.mainQueue()) { notification -> Void in - let event = (notification.userInfo![FBSDKAccessTokenChangeNewKey] != nil) ? "onFacebookLogin" : "onFacebookLogout" - self.appController?.evaluateInJavaScriptContext({ context -> Void in + queue: OperationQueue.main) { notification -> Void in + let event = ((notification as NSNotification).userInfo![FBSDKAccessTokenChangeNewKey] != nil) ? "customOnFacebookLogin" : "customOnFacebookLogout" + self.appController?.evaluate(inJavaScriptContext: { context -> Void in context.evaluateScript("navigationDocument.documents[0].dispatchEvent(new CustomEvent('\(event)'))") }, completion: nil) } // Connect the FBSDK to get TVML extensions - TVInterfaceFactory.sharedInterfaceFactory().extendedInterfaceCreator = FBSDKTVInterfaceFactory() + TVInterfaceFactory.shared().extendedInterfaceCreator = FBSDKTVInterfaceFactory() // Make sure you start a webserver that can serve the 'client' directory. // For example, run `python -m SimpleHTTPServer 9002` from the 'client' directory. // Note for this sample, App Transport Security has been set to Allow Arbitrary Loads. - let javascriptURL = NSURL(string: "http://localhost:\(SecondViewController.kPort)/main.js") + let javascriptURL = URL(string: "http://localhost:\(SecondViewController.kPort)/main.js") let appControllerContext = TVApplicationControllerContext() appControllerContext.javaScriptApplicationURL = javascriptURL! appController = TVApplicationController(context: appControllerContext, window: nil, delegate: self) @@ -57,50 +57,53 @@ class SecondViewController: UIViewController { } extension SecondViewController: TVApplicationControllerDelegate { - func appController(appController: TVApplicationController, didFinishLaunchingWithOptions options: [String: AnyObject]?) { + func appController(_ appController: TVApplicationController, didFinishLaunching options: [String: Any]?) { // TVJS loaded, add its navigation controller to our heirarchy. navigationController?.addChildViewController(appController.navigationController) navigationController?.view.addSubview(appController.navigationController.view) - appController.navigationController.didMoveToParentViewController(navigationController) + appController.navigationController.didMove(toParentViewController: navigationController) } - func appController(appController: TVApplicationController, evaluateAppJavaScriptInContext jsContext: JSContext) { + func appController(_ appController: TVApplicationController, evaluateAppJavaScriptIn jsContext: JSContext) { // Add the TVML/TVJS extensions for FBSDK - jsContext.setObject(FBSDKJS.self, forKeyedSubscript: "FBSDKJS") + jsContext.setObject(FBSDKJS.self, forKeyedSubscript: "FBSDKJS" as (NSCopying & NSObjectProtocol)!) // Define a custom _shareLink helper - let shareLink: @convention(block) Void -> Void = { + let shareLink: @convention(block) (Void) -> Void = { let content = FBSDKShareLinkContent() - content.contentURL = NSURL(string: "http://www.apple.com/tv/")! - FBSDKShareAPI.shareWithContent(content, delegate: self) + content.contentURL = URL(string: "http://www.apple.com/tv/")! + FBSDKShareAPI.share(with: content, delegate: self) } - jsContext.setObject(unsafeBitCast(shareLink, AnyObject.self), forKeyedSubscript: "_shareLink") + jsContext.setObject(unsafeBitCast(shareLink, to: AnyObject.self), forKeyedSubscript: "_shareLink" as (NSCopying & NSObjectProtocol)!) } - func appController(appController: TVApplicationController, didFailWithError error: NSError) { + func appController(_ appController: TVApplicationController, didFail error: Error) { let title = "TVML Error" - let message = error.code == TVMLKitError.FailedToLaunch.rawValue ? - "Did you start the web server in the 'client' directory on port \(SecondViewController.kPort)? " + - "You can run 'python -m SimpleHTTPServer \(SecondViewController.kPort)' from the 'client' directory." - : error.localizedDescription - let alertController = UIAlertController(title: title, message: message, preferredStyle:.Alert) - navigationController?.presentViewController(alertController, animated: true, completion: nil) + let nserror = error as NSError + let message = + (nserror.code == TVMLKitError.failedToLaunch.rawValue ? + "Did you start the web server in the 'client' directory on port \(SecondViewController.kPort)? " + + "You can run 'python -m SimpleHTTPServer \(SecondViewController.kPort)' from the 'client' directory." + : error.localizedDescription ) + + let alertController = UIAlertController(title: title, message: message, preferredStyle:.alert) + navigationController?.present(alertController, animated: true, completion: nil) } } extension SecondViewController: FBSDKSharingDelegate { - func sharer(sharer: FBSDKSharing!, didCompleteWithResults results: [NSObject : AnyObject]!) { - appController!.evaluateInJavaScriptContext({ (context) -> Void in + func sharer(_ sharer: FBSDKSharing!, didCompleteWithResults results: [AnyHashable: Any]!) { + appController!.evaluate(inJavaScriptContext: { (context) -> Void in context.evaluateScript("shareLinkCallback()") }, completion: nil) } - func sharer(sharer: FBSDKSharing!, didFailWithError error: NSError!) { + public func sharer(_ sharer: FBSDKSharing!, didFailWithError error: Error!) { print("Share failed %@", error) } - func sharerDidCancel(sharer: FBSDKSharing!) { + func sharerDidCancel(_ sharer: FBSDKSharing!) { print("Share cancelled") } } diff --git a/samples/HelloTV/client/main.js b/samples/HelloTV/client/main.js index a58ab9c51b..aa2969f65f 100644 --- a/samples/HelloTV/client/main.js +++ b/samples/HelloTV/client/main.js @@ -88,8 +88,8 @@ App.onLaunch = function(options) { shareLinkButton.addEventListener("select", onShareLinkButtonSelect); doc.addEventListener("onFacebookLoginCancel", onLoginCancel); doc.addEventListener("onFacebookLoginError", onLoginError); - doc.addEventListener("onFacebookLogin", onLoginStatusChange); - doc.addEventListener("onFacebookLogout", onLoginStatusChange); + doc.addEventListener("customOnFacebookLogin", onLoginStatusChange); + doc.addEventListener("customOnFacebookLogout", onLoginStatusChange); // Log event for app analytics. FBSDKJS.logEventParameters('tvml-app-launch'); diff --git a/samples/HelloTV/client/main.tvml b/samples/HelloTV/client/main.tvml index 35e718016c..329cbe9167 100644 --- a/samples/HelloTV/client/main.tvml +++ b/samples/HelloTV/client/main.tvml @@ -1,7 +1,7 @@ - + @@ -10,4 +10,4 @@ Share Link (API) - \ No newline at end of file + diff --git a/scripts/build_distribution.sh b/scripts/build_distribution.sh index 1c242435d4..ca0f9843af 100755 --- a/scripts/build_distribution.sh +++ b/scripts/build_distribution.sh @@ -105,7 +105,7 @@ done # Build AKFAccountKit framework # if [ -z $SKIPBUILD ]; then - ("$XCTOOL" -project "${FB_SDK_ROOT}"/AccountKit/AccountKit.xcodeproj -scheme "AccountKit-Universal" -configuration Release clean build) || die "Failed to build account kit" + (xcodebuild -project "${FB_SDK_ROOT}"/AccountKit/AccountKit.xcodeproj -scheme "AccountKit-Universal" -configuration Release clean build) || die "Failed to build account kit" fi \cp -R "$FB_SDK_BUILD"/AccountKit.framework "$FB_SDK_BUILD_PACKAGE" \ || die "Could not copy AccountKit.framework" @@ -127,7 +127,7 @@ fi # if [ -z $SKIPBUILD ]; then - ("$XCTOOL" -workspace "${FB_SDK_ROOT}"/ads/src/FBAudienceNetwork.xcworkspace -scheme "BuildAll-Universal" -configuration Release clean build) || die "Failed to build FBAudienceNetwork" + (xcodebuild -workspace "${FB_SDK_ROOT}"/ads/src/FBAudienceNetwork.xcworkspace -scheme "BuildAll-Universal" -configuration Release clean build) || die "Failed to build FBAudienceNetwork" fi FBAN_SAMPLES=$FB_SDK_BUILD_PACKAGE/Samples/FBAudienceNetwork \cp -R "$FB_SDK_ROOT"/ads/build/FBAudienceNetwork.framework "$FB_SDK_BUILD_PACKAGE" \ @@ -151,7 +151,7 @@ done # Build Messenger Kit # if [ -z $SKIPBUILD ]; then - ("$XCTOOL" -project "${FB_SDK_ROOT}"/FBSDKMessengerShareKit/FBSDKMessengerShareKit.xcodeproj -scheme "FBSDKMessengerShareKit-universal" -configuration Release clean build) || die "Failed to build messenger kit" + (xcodebuild -project "${FB_SDK_ROOT}"/FBSDKMessengerShareKit/FBSDKMessengerShareKit.xcodeproj -scheme "FBSDKMessengerShareKit-universal" -configuration Release clean build) || die "Failed to build messenger kit" fi \cp -R "$FB_SDK_BUILD"/FBSDKMessengerShareKit.framework "$FB_SDK_BUILD_PACKAGE" \ || die "Could not copy FBSDKMessengerShareKit.framework" diff --git a/scripts/build_framework.sh b/scripts/build_framework.sh index 0c9c802401..085aaae2e9 100755 --- a/scripts/build_framework.sh +++ b/scripts/build_framework.sh @@ -77,7 +77,7 @@ test -d "$FB_SDK_BUILD" \ || die "Could not create directory $FB_SDK_BUILD" cd "$FB_SDK_ROOT" -("$XCTOOL" -workspace "${FB_SDK_ROOT}"/FacebookSDK.xcworkspace -scheme "${SCHEME}" -configuration "${BUILDCONFIGURATION}" clean build) || die "Failed to build" +(xcodebuild -workspace "${FB_SDK_ROOT}"/FacebookSDK.xcworkspace -scheme "${SCHEME}" -configuration "${BUILDCONFIGURATION}" clean build) || die "Failed to build" # ----------------------------------------------------------------------------- # Run unit tests diff --git a/scripts/common.sh b/scripts/common.sh index 3b67c78b08..8f0ca31b40 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -111,20 +111,6 @@ if [ -z $FB_SDK_ENV ]; then show_summary exit 1 } - - test -n "$XCODESELECT" || XCODESELECT=$(which xcode-select) - test -n "$XCTOOL" || XCTOOL=$FB_SDK_ROOT/vendor/xctool/xctool.sh - test -n "$LIPO" || LIPO=$(which lipo) - test -n "$PACKAGEBUILD" || PACKAGEBUILD=$(which pkgbuild) - test -n "$PRODUCTBUILD" || PRODUCTBUILD=$(which productbuild) - test -n "$PRODUCTSIGN" || PRODUCTSIGN=$(which productsign) - - # < Xcode 4.3.1 - if [ ! -x "$XCODEBUILD" ]; then - # Xcode from app store - XCODEBUILD="`"$XCODESELECT" -p`/usr/bin/xcodebuild" - fi - fi # Increment depth every time we . this file. At the end of any script diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 70612bea4d..e107d1006e 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -69,15 +69,16 @@ cd "$FB_SDK_ROOT" for SCHEME in $SCHEMES; do if [[ $SCHEME == "BuildAllKits" ]]; then # Build iOS frameworks and run unit tests - ( $XCTOOL -workspace FacebookSDK.xcworkspace \ + ( xcodebuild -workspace FacebookSDK.xcworkspace \ -scheme "BuildAllKits" \ -configuration $BUILDCONFIGURATION \ -sdk iphonesimulator \ - build-tests run-tests + -destination 'platform=iOS Simulator,name=iPhone 5' \ + test ) || exit $? # Build tvOS frameworks - ( $XCTOOL -workspace FacebookSDK.xcworkspace \ + ( xcodebuild -workspace FacebookSDK.xcworkspace \ -scheme "BuildAllKits_TV" \ -configuration $BUILDCONFIGURATION \ -sdk appletvsimulator \ @@ -85,14 +86,14 @@ for SCHEME in $SCHEMES; do ) || exit $? elif [[ $SCHEME == "samples" ]]; then ( cd "$FB_SDK_ROOT/samples/HelloTV" - $XCTOOL -project "HelloTV.xcodeproj" -scheme "HelloTV" -sdk appletvsimulator build + xcodebuild -project "HelloTV.xcodeproj" -scheme "HelloTV" -sdk appletvsimulator build ) || exit $? FAILED_SAMPLES="" for SAMPLE in Iconicus RPSSample Scrumptious ShareIt SwitchUserSample; do ( cd "$FB_SDK_ROOT/samples/$SAMPLE" - $XCTOOL -project "$SAMPLE.xcodeproj" -scheme "$SAMPLE" -sdk iphonesimulator build + xcodebuild -project "$SAMPLE.xcodeproj" -scheme "$SAMPLE" -sdk iphonesimulator build ) if [[ $? -ne 0 ]]; then FAILED_SAMPLES="$FAILED_SAMPLES $SAMPLE" @@ -105,12 +106,13 @@ for SCHEME in $SCHEMES; do source "internal/scripts/run_internal_tests.sh" fi else - COMMAND="$XCTOOL + COMMAND="xcodebuild -workspace FacebookSDK.xcworkspace \ -scheme $SCHEME \ -configuration $BUILDCONFIGURATION \ -sdk iphonesimulator \ - build-tests run-tests" + -destination 'platform=iOS Simulator,name=iPhone 5' \ + test" eval $COMMAND || die "Error while running tests ($COMMAND)" fi done