Skip to content

Commit 7ab9c3c

Browse files
authored
Remove FIRAppEnvironmentUtil's sharedApplication (#603)
* Deprecate FIRAppEnvironmentUtil sharedApplication * Remove sharedApplication private API. This also allows us to remove an AppKit dependency. * Disable autolink when building FirebaseCore (#606) This prevents the dependencies of FirebaseCore's dependencies from bleeding into its interface. The proximate benefit of avoiding this is that FirebaseCore no longer ends up depending on ColorSync.framework which became a top-level system framework in 10.13. This makes it possible to build against the resulting FirebaseCore.framework on macOS 10.12 using Xcode 9 (with the macOS 10.13 SDK).
1 parent c4dcfaa commit 7ab9c3c

File tree

4 files changed

+10
-37
lines changed

4 files changed

+10
-37
lines changed

Firebase/Core/third_party/FIRAppEnvironmentUtil.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19-
#if TARGET_OS_IOS
20-
#import <UIKit/UIKit.h>
21-
#elif TARGET_OS_OSX
22-
#import <AppKit/AppKit.h>
23-
#endif
24-
2519
@interface FIRAppEnvironmentUtil : NSObject
2620

2721
/// Indicates whether the app is from Apple Store or not. Returns NO if the app is on simulator,
@@ -46,12 +40,4 @@
4640
/// Indicates whether it is running inside an extension or an app.
4741
+ (BOOL)isAppExtension;
4842

49-
#if TARGET_OS_IOS
50-
/// Returns the [UIApplication sharedApplication] if it is running on an app, not an extension.
51-
+ (UIApplication *)sharedApplication;
52-
#elif TARGET_OS_OSX
53-
/// Returns the [NSApplication sharedApplication].
54-
+ (NSApplication *)sharedApplication;
55-
#endif
56-
5743
@end

Firebase/Core/third_party/FIRAppEnvironmentUtil.m

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
// limitations under the License.
1414

1515
#import <Foundation/Foundation.h>
16+
#if TARGET_OS_IOS || TARGET_OS_TV
17+
#import <UIKit/UIKit.h>
18+
#endif
1619

1720
#import "FIRAppEnvironmentUtil.h"
1821

@@ -221,25 +224,6 @@ + (BOOL)isAppExtension {
221224
#endif
222225
}
223226

224-
#if TARGET_OS_IOS
225-
+ (UIApplication *)sharedApplication {
226-
if ([FIRAppEnvironmentUtil isAppExtension]) {
227-
return nil;
228-
}
229-
id sharedApplication = nil;
230-
Class uiApplicationClass = NSClassFromString(@"UIApplication");
231-
if (uiApplicationClass &&
232-
[uiApplicationClass respondsToSelector:(NSSelectorFromString(@"sharedApplication"))]) {
233-
sharedApplication = [uiApplicationClass sharedApplication];
234-
}
235-
return sharedApplication;
236-
}
237-
#elif TARGET_OS_OSX
238-
+ (NSApplication *)sharedApplication {
239-
return [NSApplication sharedApplication];
240-
}
241-
#endif
242-
243227
#pragma mark - Helper methods
244228

245229
+ (BOOL)hasSCInfoFolder {

FirebaseCore.podspec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration
2626
s.source_files = 'Firebase/Core/**/*.[mh]'
2727
s.public_header_files = 'Firebase/Core/Public/*.h', 'Firebase/Core/Private/*.h'
2828
s.private_header_files = 'Firebase/Core/Private/*.h'
29-
s.framework = 'SystemConfiguration'
29+
s.frameworks = [
30+
'Foundation',
31+
'SystemConfiguration'
32+
]
3033
s.dependency 'GoogleToolboxForMac/NSData+zlib', '~> 2.1'
3134
s.pod_target_xcconfig = {
32-
'OTHER_CFLAGS' => '-DFIRCore_VERSION=' + s.version.to_s + ' -DFirebase_VERSION=4.8.0'
35+
'OTHER_CFLAGS' => '-fno-autolink ' +
36+
'-DFIRCore_VERSION=' + s.version.to_s + ' -DFirebase_VERSION=4.8.0'
3337
}
3438
end

cmake/FindFirebaseCore.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ if(FIREBASECORE_FOUND)
3333
${FIREBASECORE_LIBRARY}/PrivateHeaders
3434
)
3535

36-
# TODO(mcg): on iOS this should depend on UIKit.
3736
set(
3837
FIREBASECORE_LIBRARIES
3938
${FIREBASECORE_LIBRARY}
40-
"-framework AppKit"
39+
"-framework Foundation"
4140
)
4241

4342
if(NOT TARGET FirebaseCore)

0 commit comments

Comments
 (0)