firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Firebase Auth does not respect FirebaseAppDelegateProxyEnabled set to false

Open sebj opened this issue 3 years ago • 13 comments

Step 1: Describe your environment

  • Xcode version: 13.0 (13A233)
  • Firebase SDK version: 8.8.0
  • Installation method: CocoaPods
  • Firebase Component: Auth

Step 2: Describe the problem

My project is not using any notification-based Firebase features (and is not using Firebase Auth phone authentication), but I have received an Apple email mentioning the issue "ITMS-90078: Missing Push Notification Entitlement" when submitting the iOS app to TestFlight.

The app does not have push notifications enabled in App Store Connect, or via any Xcode entitlement, and the Info.plist key FirebaseAppDelegateProxyEnabled is set to a boolean value of false:

<key>FirebaseAppDelegateProxyEnabled</key>
<false/>

My hunch is that Firebase Auth is still attempting to proxy my app delegate or to swizzle any app delegate methods, including APNS related methods, despite FirebaseAppDelegateProxyEnabled set to false.

I'm also using the Firebase Analytics and Crashlytics subspecs, so I might be totally wrong on this, but searching through this repo for proxyOriginalDelegateIncludingAPNSMethods shows the only subspec I'm using in my project that calls that method is Firebase Auth.

sebj avatar Oct 05 '21 14:10 sebj

Hi @sebj,

  • Has the issue happened before even if the FirebaseAppDelegateProxyEnabled is set to false?
  • Is it possible for you to try removing FirebaseAppDelegateProxyEnabled and see if you'll still receive the same email?

Also, the message you've shared seems to be a warning, so it shouldn't mean that your app is rejected.

rizafran avatar Oct 05 '21 16:10 rizafran

Hi @rizafran,

  • This is the first time I've set FirebaseAppDelegateProxyEnabled to false and then submitted, giving the warning
  • A previous build without the key FirebaseAppDelegateProxyEnabled had the same warning email

I'm aware that the app wouldn't be rejected, but it seems like an avoidable warning given I'd expect FirebaseAppDelegateProxyEnabled to have some effect on Firebase Auth in this case (or at least have some other opt-out from this behaviour otherwise perhaps)

sebj avatar Oct 05 '21 16:10 sebj

Adding GoogleUtilities tag since my expectation would be that FirebaseAppDelegateProxyEnabled should be handled the same in GoogleUtilities whether being used from Firebase Auth or Firebase Messaging.

paulb777 avatar Oct 05 '21 21:10 paulb777

I suspect the warning may be an issue with Apple's analysis tools, as breakpointing inside both GULAppDelegateSwizzler and GULSceneDelegateSwizzler seems to show the Firebase SDK is reading FirebaseAppDelegateProxyEnabled as expected and not swizzling anything

sebj avatar Mar 03 '22 17:03 sebj

@sebj Does this issue still exist for you? I wonder if it's because the under the hood swizzling code still shows Push notification API that cause this even though swizzling code is not called.

charlotteliang avatar Mar 10 '22 22:03 charlotteliang

@chliangGoogle Yes, the issue still exists for me unfortunately – still getting the same email from Apple each time a new build is submitted.

sebj avatar Mar 10 '22 23:03 sebj

I'm experiencing this issue now. Even if App Store does not reject apps related ITMS-90078, is there any chance for this issue to be prioritised?

I've spent a great deal of time digging through Firebase's documentation along with this issue to understand the root cause. I'm sure it's the same for many others trying to integrate with Firebase.

sallychung avatar Apr 20 '23 03:04 sallychung

commenting to let know that this is happening with app that I've been working on right now, and I can still repro this issues. Pods that I am using are,

pod 'Firebase/Crashlytics'
 pod 'Firebase/Analytics' 
 pod 'FirebaseAuth'

Any heads up are appreciated to help resolve this issue.

fatinWasta avatar Jun 16 '23 12:06 fatinWasta

@andrewheard Any lead on this? Much appreciated

Pratik-Sodha avatar Nov 25 '23 14:11 Pratik-Sodha

@andrewheard any update on this? I'm facing the same issue.

ajaysubra avatar Feb 14 '24 17:02 ajaysubra

As discussed above, this seems to be an issue with Apple's tooling since the FirebaseAppDelegateProxyEnabled flag is honored.

Happy to consider a PR to FirebaseAuth to check the FirebaseAppDelegateProxyEnabled flag and stop the call chain earlier if it addresses the warning.

paulb777 avatar Feb 14 '24 18:02 paulb777

@chliangGoogle Yes, the issue still exists for me unfortunately – still getting the same email from Apple each time a new build is submitted.

@paulb777 thanks for the quick response. My issue is slightly different. Let me explain - I've integrate firebase-ios-sdk in my react native iOS app using SPM. I've added the key value pair required to disable swizzling to my plist -

	<key>FirebaseAppDelegateProxyEnabled</key>
	<false/>

My UNUserNotificationCenter delegates still don't seem to called. Here's my AppDelegate file for reference.

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTLinkingManager.h>
#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>
#import <FirebaseCore/FirebaseCore.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
   openURL:(NSURL *)url
   options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  self.moduleName = @"KlaviyoRNTestApp";
  // You can add your custom initial props in the dictionary below.
  // They will be passed down to the ViewController used by React Native.
  self.initialProps = @{};
  
  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
  center.delegate = self;
  // helper method that uses UNUserNotificationCenter to request push permission from the user.
  [PushNotificationsHelper requestPushPermissions];
  
   return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}


- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  // Convert the token to a string
  NSUInteger length = deviceToken.length;
  if (length == 0) {
    return;
  }
  const unsigned char *buffer = (const unsigned char *)[deviceToken bytes];
  NSMutableString *hexString  = [NSMutableString stringWithCapacity:(length * 2)];
  for (int i = 0; i < length; ++i) {
    [hexString appendFormat:@"%02x", buffer[i]];
  }
  self.pushToken = hexString;
  NSLog(@"push token = %@", hexString);
}


- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {
  NSLog(@"In did receive push response");
  [PushNotificationsHelper handleWithResponse:response completionHandler:completionHandler];
}

@end

Thanks. Happy to open a separate issue if my problem is unrelated to this thread here.

ajaysubra avatar Feb 14 '24 21:02 ajaysubra

@ajaysubra Yes. That sounds like a separate issue that should be opened at https://github.com/invertase/react-native-firebase

paulb777 avatar Feb 14 '24 21:02 paulb777

Closing for staleness.

paulb777 avatar May 10 '24 21:05 paulb777