From 7ab9c3c498a3cadb7a1d1a706642e10d228d4690 Mon Sep 17 00:00:00 2001 From: Ryan Wilson Date: Tue, 2 Jan 2018 18:43:04 -0500 Subject: 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). --- Firebase/Core/third_party/FIRAppEnvironmentUtil.h | 14 -------------- Firebase/Core/third_party/FIRAppEnvironmentUtil.m | 22 +++------------------- FirebaseCore.podspec | 8 ++++++-- cmake/FindFirebaseCore.cmake | 3 +-- 4 files changed, 10 insertions(+), 37 deletions(-) diff --git a/Firebase/Core/third_party/FIRAppEnvironmentUtil.h b/Firebase/Core/third_party/FIRAppEnvironmentUtil.h index 7ae9827..09ee504 100644 --- a/Firebase/Core/third_party/FIRAppEnvironmentUtil.h +++ b/Firebase/Core/third_party/FIRAppEnvironmentUtil.h @@ -16,12 +16,6 @@ #import -#if TARGET_OS_IOS -#import -#elif TARGET_OS_OSX -#import -#endif - @interface FIRAppEnvironmentUtil : NSObject /// Indicates whether the app is from Apple Store or not. Returns NO if the app is on simulator, @@ -46,12 +40,4 @@ /// Indicates whether it is running inside an extension or an app. + (BOOL)isAppExtension; -#if TARGET_OS_IOS -/// Returns the [UIApplication sharedApplication] if it is running on an app, not an extension. -+ (UIApplication *)sharedApplication; -#elif TARGET_OS_OSX -/// Returns the [NSApplication sharedApplication]. -+ (NSApplication *)sharedApplication; -#endif - @end diff --git a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m index fe4e23d..859c04e 100644 --- a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m +++ b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m @@ -13,6 +13,9 @@ // limitations under the License. #import +#if TARGET_OS_IOS || TARGET_OS_TV +#import +#endif #import "FIRAppEnvironmentUtil.h" @@ -221,25 +224,6 @@ static BOOL isAppEncrypted() { #endif } -#if TARGET_OS_IOS -+ (UIApplication *)sharedApplication { - if ([FIRAppEnvironmentUtil isAppExtension]) { - return nil; - } - id sharedApplication = nil; - Class uiApplicationClass = NSClassFromString(@"UIApplication"); - if (uiApplicationClass && - [uiApplicationClass respondsToSelector:(NSSelectorFromString(@"sharedApplication"))]) { - sharedApplication = [uiApplicationClass sharedApplication]; - } - return sharedApplication; -} -#elif TARGET_OS_OSX -+ (NSApplication *)sharedApplication { - return [NSApplication sharedApplication]; -} -#endif - #pragma mark - Helper methods + (BOOL)hasSCInfoFolder { diff --git a/FirebaseCore.podspec b/FirebaseCore.podspec index 59460ef..958a936 100644 --- a/FirebaseCore.podspec +++ b/FirebaseCore.podspec @@ -26,9 +26,13 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration s.source_files = 'Firebase/Core/**/*.[mh]' s.public_header_files = 'Firebase/Core/Public/*.h', 'Firebase/Core/Private/*.h' s.private_header_files = 'Firebase/Core/Private/*.h' - s.framework = 'SystemConfiguration' + s.frameworks = [ + 'Foundation', + 'SystemConfiguration' + ] s.dependency 'GoogleToolboxForMac/NSData+zlib', '~> 2.1' s.pod_target_xcconfig = { - 'OTHER_CFLAGS' => '-DFIRCore_VERSION=' + s.version.to_s + ' -DFirebase_VERSION=4.8.0' + 'OTHER_CFLAGS' => '-fno-autolink ' + + '-DFIRCore_VERSION=' + s.version.to_s + ' -DFirebase_VERSION=4.8.0' } end diff --git a/cmake/FindFirebaseCore.cmake b/cmake/FindFirebaseCore.cmake index e23d6db..6e68dfb 100644 --- a/cmake/FindFirebaseCore.cmake +++ b/cmake/FindFirebaseCore.cmake @@ -33,11 +33,10 @@ if(FIREBASECORE_FOUND) ${FIREBASECORE_LIBRARY}/PrivateHeaders ) - # TODO(mcg): on iOS this should depend on UIKit. set( FIREBASECORE_LIBRARIES ${FIREBASECORE_LIBRARY} - "-framework AppKit" + "-framework Foundation" ) if(NOT TARGET FirebaseCore) -- cgit v1.2.3