Skip to content

Commit abd3f6c

Browse files
joesusfacebook-github-bot
authored andcommitted
Stop shadowing dataTask method on NSURLSession (#1721)
Summary: Pull Request resolved: #1721 This was causing issues in calling the `dataTask(with: URL)` method on instances of `NSURLSession`. Moves the default conformance to the places that use it so it's not in the header for Basics which is public when using CocoaPods. Should resolve: #1643 and #1718 Reviewed By: linmx0130 Differential Revision: D27920718 fbshipit-source-id: fdc85dc2f9340285074214d7ea0b2ef9944337ce
1 parent bc532b9 commit abd3f6c

7 files changed

Lines changed: 49 additions & 9 deletions

File tree

FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,10 @@
10271027
F44DD78725EB2ECE00F2BB20 /* FBSDKGraphRequestHTTPMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = F44DD78525EB2ECE00F2BB20 /* FBSDKGraphRequestHTTPMethod.h */; settings = {ATTRIBUTES = (Public, ); }; };
10281028
F44DD78825EB2ECE00F2BB20 /* FBSDKGraphRequestHTTPMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = F44DD78525EB2ECE00F2BB20 /* FBSDKGraphRequestHTTPMethod.h */; settings = {ATTRIBUTES = (Public, ); }; };
10291029
F44DD78925EB2ECE00F2BB20 /* FBSDKGraphRequestHTTPMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = F44DD78525EB2ECE00F2BB20 /* FBSDKGraphRequestHTTPMethod.h */; settings = {ATTRIBUTES = (Public, ); }; };
1030+
F44E71032630C40600BF26C0 /* NSURLSession+Protocols.h in Headers */ = {isa = PBXBuildFile; fileRef = F44E70FB2630C40600BF26C0 /* NSURLSession+Protocols.h */; };
1031+
F44E71042630C40600BF26C0 /* NSURLSession+Protocols.h in Headers */ = {isa = PBXBuildFile; fileRef = F44E70FB2630C40600BF26C0 /* NSURLSession+Protocols.h */; };
1032+
F44E71052630C40600BF26C0 /* NSURLSession+Protocols.h in Headers */ = {isa = PBXBuildFile; fileRef = F44E70FB2630C40600BF26C0 /* NSURLSession+Protocols.h */; };
1033+
F44E71062630C40600BF26C0 /* NSURLSession+Protocols.h in Headers */ = {isa = PBXBuildFile; fileRef = F44E70FB2630C40600BF26C0 /* NSURLSession+Protocols.h */; };
10301034
F44F52F925FAAAFF00D774B7 /* SettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F44F52F025FAAAFE00D774B7 /* SettingsTests.swift */; };
10311035
F44F538325FAC1E800D774B7 /* TestTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F46873E525F7D0D500ABD912 /* TestTools.framework */; };
10321036
F44F53DC25FAC63900D774B7 /* TestAppEventsConfigurationProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F44F53DB25FAC63900D774B7 /* TestAppEventsConfigurationProvider.swift */; };
@@ -1900,6 +1904,7 @@
19001904
F44B056E256491590059A3A6 /* FBSDKBridgeAPI+SessionCompletionHandlerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "FBSDKBridgeAPI+SessionCompletionHandlerTests.m"; sourceTree = "<group>"; };
19011905
F44CFF6225D4931C000E36E5 /* FBSDKURLSession+URLSessionProxying.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FBSDKURLSession+URLSessionProxying.h"; sourceTree = "<group>"; };
19021906
F44DD78525EB2ECE00F2BB20 /* FBSDKGraphRequestHTTPMethod.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBSDKGraphRequestHTTPMethod.h; sourceTree = "<group>"; };
1907+
F44E70FB2630C40600BF26C0 /* NSURLSession+Protocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURLSession+Protocols.h"; sourceTree = "<group>"; };
19031908
F44F52F025FAAAFE00D774B7 /* SettingsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTests.swift; sourceTree = "<group>"; };
19041909
F44F53AF25FAC2F600D774B7 /* FBSDKAppEventsConfigurationProviding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBSDKAppEventsConfigurationProviding.h; sourceTree = "<group>"; };
19051910
F44F53DB25FAC63900D774B7 /* TestAppEventsConfigurationProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestAppEventsConfigurationProvider.swift; sourceTree = "<group>"; };
@@ -2522,6 +2527,7 @@
25222527
F43D7F2A2603C872005AE003 /* NSNotificationCenter+Extensions.h */,
25232528
F43D7E6026027D39005AE003 /* NSProcessInfo+Protocols.h */,
25242529
F4A02F9425EEB09500D19DE9 /* NSUserDefaults+FBSDKDataPersisting.h */,
2530+
F44E70FB2630C40600BF26C0 /* NSURLSession+Protocols.h */,
25252531
89830F251A7805A900226ABB /* ServerConfiguration */,
25262532
9D32A8381A69941A000A936D /* TokenCaching */,
25272533
89FB8C3E1A842393003CAE60 /* UI */,
@@ -3495,6 +3501,7 @@
34953501
5DB7B07F230363190012E8CB /* FBSDKInstrumentManager.h in Headers */,
34963502
9E5D8787260A30120064F8AC /* FBSDKUnarchiverProvider.h in Headers */,
34973503
F462DBF123B94C1000FFCECA /* FBSDKCrypto.h in Headers */,
3504+
F44E71062630C40600BF26C0 /* NSURLSession+Protocols.h in Headers */,
34983505
814AC8271D1B528900D61E6C /* FBSDKDeviceButton.h in Headers */,
34993506
F44164CB25CAFE9700DAB0A5 /* FBSDKJSONValue.h in Headers */,
35003507
F44164A225CAFE8300DAB0A5 /* FBSDKURLSession.h in Headers */,
@@ -3589,6 +3596,7 @@
35893596
C638153D257EA7CC00B7690F /* FBSDKAuthenticationTokenFactory.h in Headers */,
35903597
81B71D481D19C87400933E93 /* FBSDKAppLinkUtility.h in Headers */,
35913598
81B71D491D19C87400933E93 /* FBSDKAppLinkResolver.h in Headers */,
3599+
F44E71042630C40600BF26C0 /* NSURLSession+Protocols.h in Headers */,
35923600
52963AA6215993C100C7B252 /* FBSDKAppLink_Internal.h in Headers */,
35933601
1678E53026152D6000F74408 /* FBSDKLogger+Logging.h in Headers */,
35943602
81B71D4A1D19C87400933E93 /* FBSDKTokenCaching.h in Headers */,
@@ -3923,6 +3931,7 @@
39233931
C5188DF9222F388400F4D8BC /* FBSDKApplicationObserving.h in Headers */,
39243932
894C0AF61A6F2278009137EF /* FBSDKBridgeAPIProtocolNativeV1.h in Headers */,
39253933
9D432FFB1C1649B000A6C377 /* FBSDKURLOpening.h in Headers */,
3934+
F44E71032630C40600BF26C0 /* NSURLSession+Protocols.h in Headers */,
39263935
893F44AC1A644744001DB0B6 /* FBSDKMath.h in Headers */,
39273936
BF247C822374E1B200A522C0 /* FBSDKSuggestedEventsIndexer.h in Headers */,
39283937
F441658325CAFED800DAB0A5 /* FBSDKCrashHandler.h in Headers */,
@@ -3989,6 +3998,7 @@
39893998
F462DBF023B94C0F00FFCECA /* FBSDKCrypto.h in Headers */,
39903999
9E5D8786260A30120064F8AC /* FBSDKUnarchiverProvider.h in Headers */,
39914000
5DB7B07E230363190012E8CB /* FBSDKInstrumentManager.h in Headers */,
4001+
F44E71052630C40600BF26C0 /* NSURLSession+Protocols.h in Headers */,
39924002
F44164BD25CAFE9700DAB0A5 /* FBSDKJSONValue.h in Headers */,
39934003
F441649425CAFE8100DAB0A5 /* FBSDKURLSession.h in Headers */,
39944004
9D9E16AE1CB46C8900C8B68F /* FBSDKDeviceButton.h in Headers */,

FBSDKCoreKit/FBSDKCoreKit/AppLink/FBSDKWebViewAppLinkResolver.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#import "FBSDKAppLinkTarget.h"
3030
#import "FBSDKCoreKitBasicsImport.h"
3131
#import "FBSDKError.h"
32+
#import "NSURLSession+Protocols.h"
3233

3334
/**
3435
Describes the callback for appLinkFromURLInBackground.

FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKAuthenticationTokenFactory.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#import <CommonCrypto/CommonCrypto.h>
3030

3131
#import "FBSDKAuthenticationTokenClaims.h"
32+
#import "NSURLSession+Protocols.h"
3233

3334
static NSString *const FBSDKBeginCertificate = @"-----BEGIN CERTIFICATE-----";
3435
static NSString *const FBSDKEndCertificate = @"-----END CERTIFICATE-----";

FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKImageDownloader.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#import "FBSDKImageDownloader.h"
2020

2121
#import "FBSDKCoreKitBasicsImport.h"
22+
#import "NSURLSession+Protocols.h"
2223

2324
static NSString *const kImageDirectory = @"fbsdkimages";
2425
static NSString *const kCachedResponseUserInfoKeyTimestamp = @"timestamp";
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
2+
//
3+
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
4+
// copy, modify, and distribute this software in source code or binary form for use
5+
// in connection with the web services and APIs provided by Facebook.
6+
//
7+
// As with any software that integrates with the Facebook platform, your use of
8+
// this software is subject to the Facebook Developer Principles and Policies
9+
// [http://developers.facebook.com/policy/]. This copyright notice shall be
10+
// included in all copies or substantial portions of the software.
11+
//
12+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
14+
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15+
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16+
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17+
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18+
19+
#import <Foundation/Foundation.h>
20+
21+
#import "FBSDKCoreKitBasicsImport.h"
22+
23+
// MARK: Default Protocol Conformances
24+
25+
@interface NSURLSessionDataTask (FBSessionDataTask) <FBSDKSessionDataTask>
26+
@end
27+
28+
@interface NSURLSession (SessionProviding) <FBSDKSessionProviding>
29+
@end

Sources/FBSDKCoreKit_Basics/FBSDKURLSession.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@
1818

1919
#import "FBSDKURLSession.h"
2020

21+
#import <Foundation/Foundation.h>
22+
2123
#import "FBSDKBasicUtility.h"
2224
#import "FBSDKURLSessionTask.h"
2325

26+
// At some point this default conformance declaration needs to be moved out of
27+
// this class and treated like the dependency it is.
28+
@interface NSURLSession (SessionProviding) <FBSDKSessionProviding>
29+
@end
30+
2431
@implementation FBSDKURLSession
2532

2633
- (instancetype)initWithDelegate:(id<NSURLSessionDataDelegate>)delegate

Sources/FBSDKCoreKit_Basics/include/FBSDKSessionProviding.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,4 @@ NS_SWIFT_NAME(SessionProviding)
4040

4141
@end
4242

43-
// MARK: Default Protocol Conformances
44-
45-
@interface NSURLSessionDataTask (SessionDataTask) <FBSDKSessionDataTask>
46-
@end
47-
48-
@interface NSURLSession (SessionProviding) <FBSDKSessionProviding>
49-
@end
50-
51-
5243
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)