From de2e2feb6bba214dafe1c62097e4fb61e9733f8a Mon Sep 17 00:00:00 2001 From: Pouya Larjani Date: Thu, 24 Aug 2017 17:46:49 -0700 Subject: [PATCH] Facebook iOS SDK 4.26 --- Configurations/Version.xcconfig | 2 +- FBSDKCoreKit.podspec | 4 +- .../FBSDKCoreKit.xcodeproj/project.pbxproj | 16 ++++++ .../FBSDKCoreKit/FBSDKApplicationDelegate.m | 12 +++-- FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h | 2 +- .../Internal/AppEvents/FBSDKTimeSpentData.m | 2 +- .../Internal/Device/FBSDKDeviceDialogView.m | 27 +++++++++- .../Internal/Device/FBSDKDeviceUtilities.h | 26 +++++++++ .../Internal/Device/FBSDKDeviceUtilities.m | 53 +++++++++++++++++++ .../Device/FBSDKSmartDeviceDialogView.m | 29 ++++++++-- .../Internal/FBSDKInternalUtility.h | 5 ++ .../Internal/FBSDKInternalUtility.m | 26 ++++++++- .../Internal/WebDialog/FBSDKWebDialog.m | 22 +++----- FBSDKLoginKit.podspec | 4 +- FBSDKPlacesKit.podspec | 4 +- FBSDKShareKit.podspec | 4 +- .../FBSDKShareKit/FBSDKShareDialog.m | 16 +++--- FBSDKTVOSKit.podspec | 4 +- .../HelloTV/HelloTV.xcodeproj/project.pbxproj | 37 +++++++++++++ scripts/build_distribution.sh | 21 +++++++- vendor/xctool | 2 +- 21 files changed, 271 insertions(+), 47 deletions(-) create mode 100644 FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceUtilities.h create mode 100644 FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceUtilities.m diff --git a/Configurations/Version.xcconfig b/Configurations/Version.xcconfig index 1a03eb6e9..be95dd354 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.25.0 +FBSDK_PROJECT_VERSION=4.26.0 MNSDK_PROJECT_VERSION=TODO_SUPPORT_MNSDK diff --git a/FBSDKCoreKit.podspec b/FBSDKCoreKit.podspec index 6c00f175f..42d23e4d9 100644 --- a/FBSDKCoreKit.podspec +++ b/FBSDKCoreKit.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.name = "FBSDKCoreKit" - s.version = "4.25.0" + s.version = "4.26.0" 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.25.0" + :tag => "sdk-version-4.26.0" } 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 4323bb038..dfef49465 100644 --- a/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj +++ b/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj @@ -36,6 +36,11 @@ /* Begin PBXBuildFile section */ 2A3DA4161CB4C0F600339BD4 /* FBSDKAppLinkUtilityTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A3DA4151CB4C0F600339BD4 /* FBSDKAppLinkUtilityTests.m */; }; + 4AF47CF31F42468E00A57A67 /* FBSDKDeviceUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AF47CF11F42468D00A57A67 /* FBSDKDeviceUtilities.m */; }; + 4AF47CF41F42468E00A57A67 /* FBSDKDeviceUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AF47CF11F42468D00A57A67 /* FBSDKDeviceUtilities.m */; }; + 4AF47CF51F42468E00A57A67 /* FBSDKDeviceUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AF47CF21F42468D00A57A67 /* FBSDKDeviceUtilities.h */; }; + 4AF47CF61F42468E00A57A67 /* FBSDKDeviceUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AF47CF21F42468D00A57A67 /* FBSDKDeviceUtilities.h */; }; + 4AF47D131F424A8700A57A67 /* CoreImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4AF47CFE1F424A8700A57A67 /* CoreImage.framework */; }; 520223F71D83C8D200CE0AB5 /* FBSDKDeviceRequestsHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 520223F51D83C8D200CE0AB5 /* FBSDKDeviceRequestsHelper.h */; }; 520223F81D83C8D200CE0AB5 /* FBSDKDeviceRequestsHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 520223F61D83C8D200CE0AB5 /* FBSDKDeviceRequestsHelper.m */; }; 52D4F0BC1D91A18D0030B7FC /* FBSDKDeviceRequestsHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 520223F61D83C8D200CE0AB5 /* FBSDKDeviceRequestsHelper.m */; }; @@ -830,6 +835,9 @@ /* Begin PBXFileReference section */ 2A3DA4151CB4C0F600339BD4 /* FBSDKAppLinkUtilityTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKAppLinkUtilityTests.m; sourceTree = ""; }; + 4AF47CF11F42468D00A57A67 /* FBSDKDeviceUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKDeviceUtilities.m; sourceTree = ""; }; + 4AF47CF21F42468D00A57A67 /* FBSDKDeviceUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKDeviceUtilities.h; sourceTree = ""; }; + 4AF47CFE1F424A8700A57A67 /* CoreImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreImage.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS11.0.sdk/System/Library/Frameworks/CoreImage.framework; sourceTree = DEVELOPER_DIR; }; 520223F51D83C8D200CE0AB5 /* FBSDKDeviceRequestsHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKDeviceRequestsHelper.h; sourceTree = ""; }; 520223F61D83C8D200CE0AB5 /* FBSDKDeviceRequestsHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKDeviceRequestsHelper.m; sourceTree = ""; }; 5F7063FA1AF733F300E42ED7 /* FBSDKAppEventsDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKAppEventsDeviceInfo.h; sourceTree = ""; }; @@ -1068,6 +1076,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 4AF47D131F424A8700A57A67 /* CoreImage.framework in Frameworks */, 8131FB461D261DED000350FF /* CoreGraphics.framework in Frameworks */, 8131FB4A1D261E06000350FF /* UIKit.framework in Frameworks */, ); @@ -1295,6 +1304,7 @@ 893F44A31A644536001DB0B6 /* Frameworks */ = { isa = PBXGroup; children = ( + 4AF47CFE1F424A8700A57A67 /* CoreImage.framework */, 9894BFFA1B73D8B300FBA6DB /* SafariServices.framework */, 9DAD87751A8AA75700FFA324 /* libOCMock.a */, 9DEE5C891A67189800D750E1 /* XCTest.framework */, @@ -1646,6 +1656,8 @@ 9D92FC4B1CB31F3A0091B6F7 /* Device */ = { isa = PBXGroup; children = ( + 4AF47CF21F42468D00A57A67 /* FBSDKDeviceUtilities.h */, + 4AF47CF11F42468D00A57A67 /* FBSDKDeviceUtilities.m */, 9D9E16B01CB46D1500C8B68F /* FBSDKDeviceButton+Internal.h */, 9D92FC611CB320430091B6F7 /* FBSDKDeviceDialogView.h */, 9D92FC621CB320430091B6F7 /* FBSDKDeviceDialogView.m */, @@ -1710,6 +1722,7 @@ 814AC8341D1B528900D61E6C /* FBSDKAccessTokenCacheV3_17.h in Headers */, 814AC8351D1B528900D61E6C /* FBSDKIcon.h in Headers */, 814AC8361D1B528900D61E6C /* FBSDKErrorRecoveryAttempter.h in Headers */, + 4AF47CF61F42468E00A57A67 /* FBSDKDeviceUtilities.h in Headers */, 814AC8371D1B528900D61E6C /* FBSDKKeychainStore.h in Headers */, 814AC8381D1B528900D61E6C /* FBSDKAccessTokenCacheV3.h in Headers */, 814AC8391D1B528900D61E6C /* FBSDKButton+Subclass.h in Headers */, @@ -1972,6 +1985,7 @@ 9D6DEEC01BC239D5001A94ED /* FBSDKAccessTokenCacheV3_17.h in Headers */, 9DDC11291BEC413000A88306 /* FBSDKIcon.h in Headers */, 9D6DEEB81BC23895001A94ED /* FBSDKErrorRecoveryAttempter.h in Headers */, + 4AF47CF51F42468E00A57A67 /* FBSDKDeviceUtilities.h in Headers */, 9D6DEEC31BC239F2001A94ED /* FBSDKKeychainStore.h in Headers */, 9D6DEEC51BC23A0E001A94ED /* FBSDKAccessTokenCacheV3.h in Headers */, 9D65383C1BF413CC008A08E9 /* FBSDKButton+Subclass.h in Headers */, @@ -2425,6 +2439,7 @@ 814AC7EE1D1B528900D61E6C /* FBSDKKeychainStoreViaBundleID.m in Sources */, 814AC7EF1D1B528900D61E6C /* FBSDKInternalUtility.m in Sources */, 814AC7F01D1B528900D61E6C /* FBSDKConstants.m in Sources */, + 4AF47CF41F42468E00A57A67 /* FBSDKDeviceUtilities.m in Sources */, 814AC7F11D1B528900D61E6C /* FBSDKDeviceViewControllerBase.m in Sources */, 814AC7F21D1B528900D61E6C /* FBSDKAppEventsState.m in Sources */, 814AC7F31D1B528900D61E6C /* FBSDKPaymentObserver.m in Sources */, @@ -2659,6 +2674,7 @@ 9D6DEECD1BC23A53001A94ED /* FBSDKKeychainStoreViaBundleID.m in Sources */, 9DB0FA931BC22B49005EB8B1 /* FBSDKInternalUtility.m in Sources */, 9DB0FA8F1BC22AD6005EB8B1 /* FBSDKConstants.m in Sources */, + 4AF47CF31F42468E00A57A67 /* FBSDKDeviceUtilities.m in Sources */, 9D10A6901CB38DF100F42AC1 /* FBSDKDeviceViewControllerBase.m in Sources */, 9D6DEEB11BC23834001A94ED /* FBSDKAppEventsState.m in Sources */, 9D6DEEBD1BC238F5001A94ED /* FBSDKPaymentObserver.m in Sources */, diff --git a/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m b/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m index d07c37d19..f88a607ce 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m +++ b/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m @@ -55,13 +55,13 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound"; FBSDKBridgeAPIRequest *_pendingRequest; FBSDKBridgeAPICallbackBlock _pendingRequestCompletionBlock; id _pendingURLOpen; + #ifdef __IPHONE_11_0 + SFAuthenticationSession *_authenticationSession NS_AVAILABLE_IOS(11_0); + #endif #endif BOOL _expectingBackground; UIViewController *_safariViewController; BOOL _isDismissingSafariViewController; -#ifdef __IPHONE_11_0 - SFAuthenticationSession *_authenticationSession; -#endif } #pragma mark - Class Methods @@ -358,6 +358,12 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound"; if (SFSafariViewControllerClass) { UIViewController *parent = fromViewController ?: [FBSDKInternalUtility topMostViewController]; + if (parent == nil) { + [FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors + formatString:@"There are no valid ViewController to present SafariViewController with", nil]; + return; + } + NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO]; NSURLQueryItem *sfvcQueryItem = [[NSURLQueryItem alloc] initWithName:@"sfvc" value:@"1"]; [components setQueryItems:[components.queryItems arrayByAddingObject:sfvcQueryItem]]; diff --git a/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h b/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h index 2d5199260..31eb80b4d 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h +++ b/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h @@ -44,5 +44,5 @@ #import #endif -#define FBSDK_VERSION_STRING @"4.25.0" +#define FBSDK_VERSION_STRING @"4.26.0" #define FBSDK_TARGET_PLATFORM_VERSION @"v2.10" diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/AppEvents/FBSDKTimeSpentData.m b/FBSDKCoreKit/FBSDKCoreKit/Internal/AppEvents/FBSDKTimeSpentData.m index ad249ecd0..8fb87e3b3 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/AppEvents/FBSDKTimeSpentData.m +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/AppEvents/FBSDKTimeSpentData.m @@ -79,7 +79,7 @@ static const long INACTIVE_SECONDS_QUANTA[] = * do to other device activity, like a text message, so this class allows those interruptions to be smoothed * out and the time actually spent in the app excluding this interruption time to be accumulated. Also, * once a certain amount of time has gone by where the app is not in the foreground, we consider the - * session to be complete, and a new session beginning. When this occurs, we log an 'activate app' event + * session to be complete, and a new session beginning. When this occurs, we log a 'deactivate app' event * with the duration of the previous session as the 'value' of this event, along with the number of * interruptions from that previous session as an event parameter. */ diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceDialogView.m b/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceDialogView.m index 86b7c8546..968f71a5e 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceDialogView.m +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceDialogView.m @@ -19,11 +19,13 @@ #import "FBSDKDeviceDialogView.h" #import "FBSDKCoreKit+Internal.h" +#import "FBSDKDeviceUtilities.h" @implementation FBSDKDeviceDialogView { UIActivityIndicatorView *_spinner; UILabel *_confirmationCodeLabel; + UIImageView *_qrImageView; } - (instancetype)initWithFrame:(CGRect)frame @@ -43,11 +45,14 @@ if (confirmationCode == nil) { _confirmationCodeLabel.text = @""; _confirmationCodeLabel.hidden = YES; + _qrImageView.hidden = YES; [_spinner startAnimating]; } else { [_spinner stopAnimating]; _confirmationCodeLabel.text = confirmationCode; _confirmationCodeLabel.hidden = NO; + _qrImageView.hidden = NO; + [_qrImageView setImage:[FBSDKDeviceUtilities buildQRCodeWithAuthorizationCode:confirmationCode]]; } } } @@ -69,6 +74,8 @@ const CGFloat kConfirmationCodeFontSize = 108; const CGFloat kFontColorValue = 119.0/255.0; const CGFloat kInstructionFontSize = 36; + const CGFloat kQRCodeMargin = 50; + const CGFloat kQRCodeSize = 200; // build the container view. UIView *dialogView = [[UIView alloc] init]; @@ -127,6 +134,20 @@ [NSLayoutConstraint constraintWithItem:_confirmationCodeLabel attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:dialogHeaderView attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0].active = YES; _confirmationCodeLabel.hidden = YES; + // Build the QR code view + _qrImageView = [[UIImageView alloc] initWithImage:[FBSDKDeviceUtilities buildQRCodeWithAuthorizationCode:NULL]]; + _qrImageView.translatesAutoresizingMaskIntoConstraints = NO; + [dialogView addSubview:_qrImageView]; + + [_qrImageView.topAnchor constraintEqualToAnchor:dialogHeaderView.bottomAnchor + constant:kQRCodeMargin].active = YES; + [_qrImageView.bottomAnchor constraintEqualToAnchor:_qrImageView.topAnchor + constant:kQRCodeSize].active = YES; + [_qrImageView.leadingAnchor constraintEqualToAnchor:dialogView.leadingAnchor + constant:kQRCodeMargin].active = YES; + [_qrImageView.trailingAnchor constraintEqualToAnchor:_qrImageView.leadingAnchor + constant:kQRCodeSize].active = YES; + // build the instructions UILabel UILabel *instructionLabel = [[UILabel alloc] init]; instructionLabel.translatesAutoresizingMaskIntoConstraints = NO; @@ -152,8 +173,10 @@ [dialogView addSubview:instructionLabel]; [instructionLabel.topAnchor constraintEqualToAnchor:dialogHeaderView.bottomAnchor constant:kVerticalSpaceBetweenHeaderViewAndInstructionLabel].active = YES; - [instructionLabel.leadingAnchor constraintEqualToAnchor:dialogView.leadingAnchor constant:kInstructionTextHorizontalMargin].active = YES; - [dialogView.trailingAnchor constraintEqualToAnchor:instructionLabel.trailingAnchor constant:kInstructionTextHorizontalMargin].active = YES; + [instructionLabel.leadingAnchor constraintEqualToAnchor:_qrImageView.trailingAnchor + constant:kQRCodeMargin].active = YES; + [dialogView.trailingAnchor constraintEqualToAnchor:instructionLabel.trailingAnchor + constant:kInstructionTextHorizontalMargin].active = YES; // build the container view for the cancel button. UIView *buttonContainerView = [[UIView alloc] init]; diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceUtilities.h b/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceUtilities.h new file mode 100644 index 000000000..c94a485b0 --- /dev/null +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceUtilities.h @@ -0,0 +1,26 @@ +// 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 FBSDKDeviceUtilities : NSObject + ++ (UIImage *)buildQRCodeWithAuthorizationCode:(NSString *)authorizationCode; + +@end diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceUtilities.m b/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceUtilities.m new file mode 100644 index 000000000..0e9b6e296 --- /dev/null +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceUtilities.m @@ -0,0 +1,53 @@ +// 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 "FBSDKDeviceUtilities.h" + +#import "FBSDKMacros.h" + +@implementation FBSDKDeviceUtilities + ++ (UIImage *)buildQRCodeWithAuthorizationCode:(NSString *)authorizationCode +{ + NSString *authorizationUri = @"https://facebook.com/device"; + if ([authorizationUri length] > 0) { + authorizationUri = [NSString stringWithFormat:@"https://facebook.com/device?user_code=%@&qr=1", authorizationCode]; + } + NSData *qrCodeData = [authorizationUri dataUsingEncoding:NSISOLatin1StringEncoding]; + + CIFilter *qrCodeFilter = [CIFilter filterWithName:@"CIQRCodeGenerator"]; + [qrCodeFilter setValue:qrCodeData forKey:@"inputMessage"]; + [qrCodeFilter setValue:@"M" forKey:@"inputCorrectionLevel"]; + + CIImage *qrCodeImage = qrCodeFilter.outputImage; + CGRect qrImageSize = CGRectIntegral(qrCodeImage.extent); + CGSize qrOutputSize = CGSizeMake(200, 200); + + CIImage *resizedImage = + [qrCodeImage imageByApplyingTransform: CGAffineTransformMakeScale(qrOutputSize.width / CGRectGetWidth(qrImageSize), + qrOutputSize.height / CGRectGetHeight(qrImageSize))]; + + return [UIImage imageWithCIImage:resizedImage]; +} + +- (instancetype)init +{ + FBSDK_NO_DESIGNATED_INITIALIZER(); + return nil; +} +@end diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKSmartDeviceDialogView.m b/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKSmartDeviceDialogView.m index 588cdb606..9094b5690 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKSmartDeviceDialogView.m +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKSmartDeviceDialogView.m @@ -19,11 +19,13 @@ #import "FBSDKSmartDeviceDialogView.h" #import "FBSDKCoreKit+Internal.h" +#import "FBSDKDeviceUtilities.h" @implementation FBSDKSmartDeviceDialogView { UIActivityIndicatorView *_spinner; UILabel *_confirmationCodeLabel; + UIImageView *_qrImageView; } - (instancetype)initWithFrame:(CGRect)frame @@ -42,11 +44,14 @@ if (confirmationCode == nil) { _confirmationCodeLabel.text = @""; _confirmationCodeLabel.hidden = YES; + _qrImageView.hidden = YES; [_spinner startAnimating]; } else { [_spinner stopAnimating]; _confirmationCodeLabel.text = confirmationCode; _confirmationCodeLabel.hidden = NO; + _qrImageView.hidden = NO; + [_qrImageView setImage:[FBSDKDeviceUtilities buildQRCodeWithAuthorizationCode:confirmationCode]]; } } } @@ -72,6 +77,8 @@ const CGFloat kFontColorValue = 119.0/255.0; const CGFloat kInstructionFontSize = 32; const CGFloat kVerticalMarginOrLabel = 40; + const CGFloat kQRCodeSize = 200; + const CGFloat kQRCodeMargin = (kWidth - kQRCodeSize) / 2; // build the container view. UIView *dialogView = [[UIView alloc] init]; @@ -176,6 +183,20 @@ [orInstructionLabel.leadingAnchor constraintEqualToAnchor:dialogView.leadingAnchor constant:kInstructionTextHorizontalMargin].active = YES; [dialogView.trailingAnchor constraintEqualToAnchor:orInstructionLabel.trailingAnchor constant:kInstructionTextHorizontalMargin].active = YES; + // Build the QR code view + _qrImageView = [[UIImageView alloc] initWithImage:[FBSDKDeviceUtilities buildQRCodeWithAuthorizationCode:NULL]]; + _qrImageView.translatesAutoresizingMaskIntoConstraints = NO; + [dialogView addSubview:_qrImageView]; + + [_qrImageView.topAnchor constraintEqualToAnchor:orInstructionLabel.bottomAnchor + constant:kVerticalMarginOrLabel].active = YES; + [_qrImageView.bottomAnchor constraintEqualToAnchor:_qrImageView.topAnchor + constant:kQRCodeSize].active = YES; + [_qrImageView.leadingAnchor constraintEqualToAnchor:dialogView.leadingAnchor + constant:kQRCodeMargin].active = YES; + [dialogView.trailingAnchor constraintEqualToAnchor:_qrImageView.trailingAnchor + constant:kQRCodeMargin].active = YES; + // build the instructions UILabel UILabel *instructionLabel = [[UILabel alloc] init]; instructionLabel.translatesAutoresizingMaskIntoConstraints = NO; @@ -198,10 +219,12 @@ [instructionLabel sizeToFit]; instructionLabel.textColor = [UIColor colorWithWhite:kFontColorValue alpha:1.0]; [dialogView addSubview:instructionLabel]; - [instructionLabel.topAnchor constraintEqualToAnchor:orInstructionLabel.bottomAnchor + [instructionLabel.topAnchor constraintEqualToAnchor:_qrImageView.bottomAnchor constant:kVerticalMarginOrLabel].active = YES; - [instructionLabel.leadingAnchor constraintEqualToAnchor:dialogView.leadingAnchor constant:kInstructionTextHorizontalMargin].active = YES; - [dialogView.trailingAnchor constraintEqualToAnchor:instructionLabel.trailingAnchor constant:kInstructionTextHorizontalMargin].active = YES; + [instructionLabel.leadingAnchor constraintEqualToAnchor:dialogView.leadingAnchor + constant:kInstructionTextHorizontalMargin].active = YES; + [dialogView.trailingAnchor constraintEqualToAnchor:instructionLabel.trailingAnchor + constant:kInstructionTextHorizontalMargin].active = YES; // build the container view for the cancel button. UIView *buttonContainerView = [[UIView alloc] init]; diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.h b/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.h index c1197f709..990f9b218 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.h +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.h @@ -313,6 +313,11 @@ setJSONStringForObject:(id)object */ + (BOOL)isRegisteredURLScheme:(NSString *)urlScheme; +/** + returns the current key window + */ ++ (UIWindow *)findWindow; + /** returns currently displayed top view controller. */ diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.m b/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.m index 0a77f484d..2cfddf056 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.m +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.m @@ -622,10 +622,34 @@ static NSMapTable *_transientObjects; } } ++ (UIWindow *)findWindow +{ + UIWindow *window = [UIApplication sharedApplication].keyWindow; + if (window == nil || window.windowLevel != UIWindowLevelNormal) { + for (window in [UIApplication sharedApplication].windows) { + if (window.windowLevel == UIWindowLevelNormal) { + break; + } + } + } + if (window == nil) { + [FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors + formatString:@"Unable to find a valid UIWindow", nil]; + } + return window; +} + (UIViewController *)topMostViewController { - UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController; + UIWindow *keyWindow = [self findWindow]; + // SDK expects a key window at this point, if it is not, make it one + if (keyWindow != nil && !keyWindow.isKeyWindow) { + [FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors + formatString:@"Unable to obtain a key window, marking %@ as keyWindow", keyWindow.description]; + [keyWindow makeKeyWindow]; + } + + UIViewController *topController = keyWindow.rootViewController; while (topController.presentedViewController) { topController = topController.presentedViewController; } diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/WebDialog/FBSDKWebDialog.m b/FBSDKCoreKit/FBSDKCoreKit/Internal/WebDialog/FBSDKWebDialog.m index 21f391dca..74cb64b13 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/WebDialog/FBSDKWebDialog.m +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/WebDialog/FBSDKWebDialog.m @@ -21,6 +21,7 @@ #import "FBSDKAccessToken.h" #import "FBSDKDynamicFrameworkLoader.h" #import "FBSDKInternalUtility.h" +#import "FBSDKLogger.h" #import "FBSDKSettings.h" #import "FBSDKTypeUtility.h" #import "FBSDKWebDialogView.h" @@ -81,8 +82,10 @@ static FBSDKWebDialog *g_currentDialog = nil; g_currentDialog = self; - UIWindow *window = [self _findWindow]; + UIWindow *window = [FBSDKInternalUtility findWindow]; if (!window) { + [FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors + formatString:@"There are no valid ViewController to present FBSDKWebDialog", nil]; [self _failWithError:nil]; return NO; } @@ -209,19 +212,6 @@ static FBSDKWebDialog *g_currentDialog = nil; }); } -- (UIWindow *)_findWindow -{ - UIWindow *window = [UIApplication sharedApplication].keyWindow; - if (window == nil || window.windowLevel != UIWindowLevelNormal) { - for (window in [UIApplication sharedApplication].windows) { - if (window.windowLevel == UIWindowLevelNormal) { - break; - } - } - } - return window; -} - - (NSURL *)_generateURL:(NSError **)errorRef { NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init]; @@ -241,8 +231,10 @@ static FBSDKWebDialog *g_currentDialog = nil; - (BOOL)_showWebView { - UIWindow *window = [self _findWindow]; + UIWindow *window = [FBSDKInternalUtility findWindow]; if (!window) { + [FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors + formatString:@"There are no valid ViewController to present FBSDKWebDialog", nil]; [self _failWithError:nil]; return NO; } diff --git a/FBSDKLoginKit.podspec b/FBSDKLoginKit.podspec index 1458b705f..b4ad8b802 100644 --- a/FBSDKLoginKit.podspec +++ b/FBSDKLoginKit.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.name = "FBSDKLoginKit" - s.version = "4.25.0" + s.version = "4.26.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 @@ -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.25.0" + :tag => "sdk-version-4.26.0" } s.weak_frameworks = "Accounts", "CoreLocation", "Social", "Security", "QuartzCore", "CoreGraphics", "UIKit", "Foundation", "AudioToolbox" diff --git a/FBSDKPlacesKit.podspec b/FBSDKPlacesKit.podspec index 6acd80061..b1d56ee7b 100644 --- a/FBSDKPlacesKit.podspec +++ b/FBSDKPlacesKit.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.name = "FBSDKPlacesKit" - s.version = "4.25.0" + s.version = "4.26.0" s.summary = "Official Facebook SDK for iOS to access Facebook Places" s.description = <<-DESC @@ -20,7 +20,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.25.0" + :tag => "sdk-version-4.26.0" } s.weak_frameworks = "Accounts", "CoreLocation", "Social", "Security", "Foundation" diff --git a/FBSDKShareKit.podspec b/FBSDKShareKit.podspec index 3c542021d..6e50eac94 100644 --- a/FBSDKShareKit.podspec +++ b/FBSDKShareKit.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.name = "FBSDKShareKit" - s.version = "4.25.0" + s.version = "4.26.0" 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.25.0" + :tag => "sdk-version-4.26.0" } s.ios.weak_frameworks = 'Accounts', 'AudioToolbox', 'CoreGraphics', 'CoreLocation', 'Foundation', 'QuartzCore', 'Security', 'Social', 'UIKit' diff --git a/FBSDKShareKit/FBSDKShareKit/FBSDKShareDialog.m b/FBSDKShareKit/FBSDKShareKit/FBSDKShareDialog.m index 8cd6c5e85..b0a94d888 100644 --- a/FBSDKShareKit/FBSDKShareKit/FBSDKShareDialog.m +++ b/FBSDKShareKit/FBSDKShareKit/FBSDKShareDialog.m @@ -200,10 +200,10 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF } message:results[@"error_message"] underlyingError:nil]; - [self _handleWebResponseParameters:nil error:error]; + [self _handleWebResponseParameters:nil error:error cancelled: NO]; } else { // not all web dialogs report cancellation, so assume that the share has completed with no additional information - [self _handleWebResponseParameters:results error:nil]; + [self _handleWebResponseParameters:results error:nil cancelled: NO]; } [FBSDKInternalUtility unregisterTransientObject:self]; } @@ -438,14 +438,16 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF return URLs; } -- (void)_handleWebResponseParameters:(NSDictionary *)webResponseParameters error:(NSError *)error +- (void)_handleWebResponseParameters:(NSDictionary *)webResponseParameters + error:(NSError *)error + cancelled:(BOOL)isCancelled { if (error) { [self _invokeDelegateDidFailWithError:error]; return; } else { NSString *completionGesture = webResponseParameters[FBSDK_SHARE_RESULT_COMPLETION_GESTURE_KEY]; - if ([completionGesture isEqualToString:FBSDK_SHARE_RESULT_COMPLETION_GESTURE_VALUE_CANCEL]) { + if ([completionGesture isEqualToString:FBSDK_SHARE_RESULT_COMPLETION_GESTURE_VALUE_CANCEL] || isCancelled) { [self _invokeDelegateDidCancel]; } else { // not all web dialogs report cancellation, so assume that the share has completed with no additional information @@ -482,7 +484,7 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF void(^completion)(BOOL, NSString *, NSDictionary *) = ^(BOOL successfullyBuilt, NSString *cMethodName, NSDictionary *cParameters) { if (successfullyBuilt) { FBSDKBridgeAPICallbackBlock completionBlock = ^(FBSDKBridgeAPIResponse *response) { - [self _handleWebResponseParameters:response.responseParameters error:response.error]; + [self _handleWebResponseParameters:response.responseParameters error:response.error cancelled: response.isCancelled]; [FBSDKInternalUtility unregisterTransientObject:self]; }; FBSDKBridgeAPIRequest *request; @@ -509,7 +511,7 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF return NO; } FBSDKBridgeAPICallbackBlock completionBlock = ^(FBSDKBridgeAPIResponse *response) { - [self _handleWebResponseParameters:response.responseParameters error:response.error]; + [self _handleWebResponseParameters:response.responseParameters error:response.error cancelled: response.isCancelled]; [FBSDKInternalUtility unregisterTransientObject:self]; }; FBSDKBridgeAPIRequest *request; @@ -535,7 +537,7 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF id shareContent = self.shareContent; NSDictionary *parameters = [FBSDKShareUtility feedShareDictionaryForContent:shareContent]; FBSDKBridgeAPICallbackBlock completionBlock = ^(FBSDKBridgeAPIResponse *response) { - [self _handleWebResponseParameters:response.responseParameters error:response.error]; + [self _handleWebResponseParameters:response.responseParameters error:response.error cancelled:response.isCancelled]; [FBSDKInternalUtility unregisterTransientObject:self]; }; FBSDKBridgeAPIRequest *request; diff --git a/FBSDKTVOSKit.podspec b/FBSDKTVOSKit.podspec index 8df0ce028..75271220a 100644 --- a/FBSDKTVOSKit.podspec +++ b/FBSDKTVOSKit.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.name = 'FBSDKTVOSKit' - s.version = '4.25.0' + s.version = '4.26.0' 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.25.0' } + :tag => 'sdk-version-4.26.0' } 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 7d6dfca2e..efd452461 100644 --- a/samples/HelloTV/HelloTV.xcodeproj/project.pbxproj +++ b/samples/HelloTV/HelloTV.xcodeproj/project.pbxproj @@ -7,6 +7,12 @@ objects = { /* Begin PBXBuildFile section */ + 4AF47D151F42509E00A57A67 /* FBSDKTVOSKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4AF47D141F42509E00A57A67 /* FBSDKTVOSKit.framework */; }; + 4AF47D161F42509E00A57A67 /* FBSDKTVOSKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4AF47D141F42509E00A57A67 /* FBSDKTVOSKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 4AF47D191F4250AB00A57A67 /* FBSDKCoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4AF47D181F4250AB00A57A67 /* FBSDKCoreKit.framework */; }; + 4AF47D1A1F4250AB00A57A67 /* FBSDKCoreKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4AF47D181F4250AB00A57A67 /* FBSDKCoreKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 4AF47D1C1F4250BB00A57A67 /* FBSDKShareKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4AF47D1B1F4250BB00A57A67 /* FBSDKShareKit.framework */; }; + 4AF47D1D1F4250BB00A57A67 /* FBSDKShareKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4AF47D1B1F4250BB00A57A67 /* FBSDKShareKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9D81FDB21C5048A900AF5F8D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D81FDB11C5048A900AF5F8D /* AppDelegate.swift */; }; 9D81FDB41C5048A900AF5F8D /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D81FDB31C5048A900AF5F8D /* FirstViewController.swift */; }; 9D81FDB61C5048A900AF5F8D /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D81FDB51C5048A900AF5F8D /* SecondViewController.swift */; }; @@ -19,7 +25,26 @@ 9DF0AAF21C51588500107B85 /* main.tvml in Resources */ = {isa = PBXBuildFile; fileRef = 9DF0AAF11C51588500107B85 /* main.tvml */; }; /* End PBXBuildFile section */ +/* Begin PBXCopyFilesBuildPhase section */ + 4AF47D171F42509E00A57A67 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 4AF47D161F42509E00A57A67 /* FBSDKTVOSKit.framework in Embed Frameworks */, + 4AF47D1A1F4250AB00A57A67 /* FBSDKCoreKit.framework in Embed Frameworks */, + 4AF47D1D1F4250BB00A57A67 /* FBSDKShareKit.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ + 4AF47D141F42509E00A57A67 /* FBSDKTVOSKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FBSDKTVOSKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 4AF47D181F4250AB00A57A67 /* FBSDKCoreKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FBSDKCoreKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 4AF47D1B1F4250BB00A57A67 /* FBSDKShareKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FBSDKShareKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9D81FDAE1C5048A900AF5F8D /* HelloTV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloTV.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9D81FDB11C5048A900AF5F8D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 9D81FDB31C5048A900AF5F8D /* FirstViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = ""; }; @@ -47,6 +72,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 4AF47D191F4250AB00A57A67 /* FBSDKCoreKit.framework in Frameworks */, + 4AF47D151F42509E00A57A67 /* FBSDKTVOSKit.framework in Frameworks */, + 4AF47D1C1F4250BB00A57A67 /* FBSDKShareKit.framework in Frameworks */, 9D81FDD61C50502400AF5F8D /* FBSDKTVOSKit.framework in Frameworks */, 9D81FDD51C50502400AF5F8D /* FBSDKCoreKit.framework in Frameworks */, 9D81FDD71C50502400AF5F8D /* FBSDKShareKit.framework in Frameworks */, @@ -59,6 +87,9 @@ 9D81FDA51C5048A900AF5F8D = { isa = PBXGroup; children = ( + 4AF47D1B1F4250BB00A57A67 /* FBSDKShareKit.framework */, + 4AF47D181F4250AB00A57A67 /* FBSDKCoreKit.framework */, + 4AF47D141F42509E00A57A67 /* FBSDKTVOSKit.framework */, 9D81FDC21C5049BC00AF5F8D /* Configurations */, 9D81FDD81C50502800AF5F8D /* Frameworks */, 9D81FDB01C5048A900AF5F8D /* HelloTV */, @@ -135,6 +166,7 @@ 9D81FDAA1C5048A900AF5F8D /* Sources */, 9D81FDAB1C5048A900AF5F8D /* Frameworks */, 9D81FDAC1C5048A900AF5F8D /* Resources */, + 4AF47D171F42509E00A57A67 /* Embed Frameworks */, ); buildRules = ( ); @@ -157,6 +189,7 @@ TargetAttributes = { 9D81FDAD1C5048A900AF5F8D = { CreatedOnToolsVersion = 7.2; + DevelopmentTeam = V9WTTPBFK9; LastSwiftMigration = 0800; }; }; @@ -305,6 +338,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = 9D81FDD11C504A0000AF5F8D /* Application-TVOS.xcconfig */; buildSettings = { + DEVELOPMENT_TEAM = V9WTTPBFK9; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; SWIFT_VERSION = 3.0; }; name = Debug; @@ -313,6 +348,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = 9D81FDD11C504A0000AF5F8D /* Application-TVOS.xcconfig */; buildSettings = { + DEVELOPMENT_TEAM = V9WTTPBFK9; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; SWIFT_VERSION = 3.0; }; name = Release; diff --git a/scripts/build_distribution.sh b/scripts/build_distribution.sh index 5f3e83cec..16bcecd29 100755 --- a/scripts/build_distribution.sh +++ b/scripts/build_distribution.sh @@ -67,11 +67,25 @@ if [ "$PACKAGE" == "$PACAKAGE_AN" ]; then AN_ZIP=$FB_AD_SDK_BUILD/$FB_AD_SDK_BINARY_NAME-$FB_AD_SDK_VERSION.zip AN_BUILD_PACKAGE=$FB_AD_SDK_BUILD/package AN_SAMPLES=$AN_BUILD_PACKAGE/Samples/FBAudienceNetwork + AN_STATIC_REPORT="${FB_SDK_ROOT}"/FBAudienceNetworkFramework.out + AN_DYNAMIC_REPORT="${FB_SDK_ROOT}"/FBAudienceNetworkDynamicFramework.out if [ -z $SKIPBUILD ]; then - (xcodebuild -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 "FBAudienceNetworkDynamicFramework-Universal" -configuration Release clean build) || die "Failed to build FBAudienceNetworkDynamicFramework" + buck build //ios-sdk/ads/src/FBAudienceNetwork:FBAudienceNetworkFramework --build-report "$AN_STATIC_REPORT" || die "Failed to build FBAudienceNetwork" + buck build //ios-sdk/ads/src/FBAudienceNetwork:FBAudienceNetworkDynamicFramework --build-report "$AN_DYNAMIC_REPORT" || die "Failed to build FBAudienceNetworkDynamicFramework" + + AN_BUCK_STATIC_OUTPUT="${FB_SDK_ROOT}/../"$(cat "$AN_STATIC_REPORT" | grep -E -m 1 '"output"' | awk -F '"' '{ print $4 }') + AN_BUCK_DYNAMIC_OUTPUT="${FB_SDK_ROOT}/../"$(cat "$AN_DYNAMIC_REPORT" | grep -E -m 1 '"output"' | awk -F '"' '{ print $4 }') + + rsync -avmc "$AN_BUCK_STATIC_OUTPUT" "$FB_AD_SDK_BUILD" \ + || die "Could not copy FBAudienceNetwork.framework" + rsync -avmc "$AN_BUCK_DYNAMIC_OUTPUT" "$FB_AD_SDK_BUILD" \ + || die "Could not copy FBAudienceNetworkDynamicFramework.framework" + + rm "$AN_STATIC_REPORT" + rm "$AN_DYNAMIC_REPORT" fi + rsync -avmc "$FB_AD_SDK_BUILD"/FBAudienceNetwork.framework "$AN_BUILD_PACKAGE" \ || die "Could not copy FBAudienceNetwork.framework" rsync -avmc "$FB_AD_SDK_BUILD"/FBAudienceNetworkDynamicFramework.framework "$AN_BUILD_PACKAGE" \ @@ -85,6 +99,9 @@ if [ "$PACKAGE" == "$PACAKAGE_AN" ]; then ${fname} > ${fname}.tmpfile && mv ${fname}.tmpfile ${fname}; \ done + check_binary_has_architectures "$FB_AD_SDK_BUILD"/FBAudienceNetwork.framework/FBAudienceNetwork "$COMMON_ARCHS"; + check_binary_has_architectures "$FB_AD_SDK_BUILD"/FBAudienceNetworkDynamicFramework.framework/FBAudienceNetworkDynamicFramework "$COMMON_ARCHS"; + # Fix up samples for fname in $(find "$AN_SAMPLES" -name "project.pbxproj" -print); do \ sed "s|../../build|../../../|g;" \ diff --git a/vendor/xctool b/vendor/xctool index 03c1c022b..efd91afb3 160000 --- a/vendor/xctool +++ b/vendor/xctool @@ -1 +1 @@ -Subproject commit 03c1c022b1936f8afbae5a297b3a3e3fa551cad7 +Subproject commit efd91afb3c0eff64bed685cd2110a11f503130bb