Repository: firebase/firebase-ios-sdk (language: cpp)

Issue:
Getting rejected in iOS App Store due to non-public API for "initWithFileName"
### Description

Hello Firebase iOS SDK Developers,

I have already forwarded this link to Apple and they are totally refusing our app submission by saying that there is a duplicate method named "initWithFileName" which comes from Google Firebase SDK. Please see the attached email from Apple App Store Review Team. They think we've created this method and they are asking us to rename it to something else but this method belongs to Google's Firebase SDK product. This is like a dead-end for us. What will it take for Google to rename this method to something very unique to Google? It is just a method name and Google can simply pick another name, thus, all problems simply go away.

Please rename Firebase method "initWithFileName" so it doesn't conflict with Apple's method "initWithFileName" when we build our IPA for their app store submission. This issue is all about the name only and the code logic remains the same.

The way our app is built is basically: Our code + Apple's code + Google's code. It is very simple but when one of three has a name that conflicts with Apple, then Apple is afraid that we will misuse this method and do something malicious since this method from Apple is a non-public method, meaning to be used by Apple only and internally.

https://github.com/firebase/firebase-ios-sdk/issues/4971

In this post it talks exactly about our issue being experienced by the others. So when you say: "I have not encountered any other cases related to iOS Apps getting denied with Firebase - with a multitude of different products being used so far, so this is quite a strange issue (and hard to track down)." then I am totally confused why you state "it's hard to track down" this when there are many others with our issue too as per the above link/post in Github. And again this issue can be very easily corrected and probably fast by the Firebase development team by simply renaming your method "initWithFileName:" to something like "googleInitWithFileName:" and rebuilding the SDK so that we can include this new version in our next app's build and then submit it for review again to Apple's App Store.

Please advise as soon as possible!

Tourist New App Team
support@touristnewapp.com




### Reproducing the issue

Apple's App Store review team refuses to accept our app due to Firebase iOS SDK method name conflict. Can't you just choose another name?

### Firebase SDK Version

10.9

### Xcode Version

15.3

### Installation Method

Swift Package Manager

### Firebase Product(s)

App Distribution, In-App Messaging

### Targeted Platforms

iOS

### Relevant Log Output

```shell
N/A
```


### If using Swift Package Manager, the project's Package.resolved

N/A

### If using CocoaPods, the project's Podfile.lock

N/A


Discussion / hints:
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Would you confirm which Firebase products are being used? I see `initWithFileName` in FirebaseMessaging, but not in App Distribution or Firebase In App Messaging.
Sorry, Paul, my fault. It is only for FirebaseMessaging

TYVM!


I'll add this to the list for the 10.29.0 release.

However, it's very strange that thousands of apps have been approved while including this code.
Hi Paul,

I totally agree and I too don't understand how our app got singled out like this, but below is Apple's rejection email to us:

App Store Connect
 
Hello,

We noticed one or more issues with a recent delivery for the following app:

Tourist New App
Version 1.0.47
Build 1.0.47
Please correct the following issues and upload a new binary to App Store Connect.

ITMS-90338: Non-public API usage - The app references non-public selectors in Tourist: initWithFileName:. If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed. For further information, visit the Technical Support Information at http://developer.apple.com/support/technical/

Apple Developer Relations


Unless this is a new app review policy that Apple just implemented?


@paulb777 When will 10.29.0 release be available? How will we know?
Thank you for all your help on this one!
Best,
Nathan
@NateShoy The 10.29.0 release is targeted for the week of July 8th. In the interim, you could apply the diff of #13139 to your build.

Fix patch:
diff --git a/FirebaseMessaging/CHANGELOG.md b/FirebaseMessaging/CHANGELOG.md
index c718a756697..29aa94a6057 100644
--- a/FirebaseMessaging/CHANGELOG.md
+++ b/FirebaseMessaging/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 10.29.0
+- [fixed] Renamed "initWithFileName" internal method that was causing submission issues for some
+  users. (#13134).
+
 # 10.27.0
 - [fixed] Fixed bug preventing Messaging from working with a custom sqlite3
   dependency (#12900).
diff --git a/FirebaseMessaging/Sources/Token/FIRMessagingBackupExcludedPlist.h b/FirebaseMessaging/Sources/Token/FIRMessagingBackupExcludedPlist.h
index 8ea043690b2..800654b0f9b 100644
--- a/FirebaseMessaging/Sources/Token/FIRMessagingBackupExcludedPlist.h
+++ b/FirebaseMessaging/Sources/Token/FIRMessagingBackupExcludedPlist.h
@@ -39,7 +39,7 @@
  *
  *  @return Helper which allows to read write data to a backup excluded plist.
  */
-- (instancetype)initWithFileName:(NSString *)fileName subDirectory:(NSString *)subDirectory;
+- (instancetype)initWithPlistFile:(NSString *)fileName subDirectory:(NSString *)subDirectory;
 
 /**
  *  Write dictionary data to the backup excluded plist file. If the file does not exist
diff --git a/FirebaseMessaging/Sources/Token/FIRMessagingBackupExcludedPlist.m b/FirebaseMessaging/Sources/Token/FIRMessagingBackupExcludedPlist.m
index ed509a88df4..812230b2154 100644
--- a/FirebaseMessaging/Sources/Token/FIRMessagingBackupExcludedPlist.m
+++ b/FirebaseMessaging/Sources/Token/FIRMessagingBackupExcludedPlist.m
@@ -28,7 +28,7 @@ @interface FIRMessagingBackupExcludedPlist ()
 
 @implementation FIRMessagingBackupExcludedPlist
 
-- (instancetype)initWithFileName:(NSString *)fileName subDirectory:(NSString *)subDirectory {
+- (instancetype)initWithPlistFile:(NSString *)fileName subDirectory:(NSString *)subDirectory {
   self = [super init];
   if (self) {
     _fileName = [fileName copy];
diff --git a/FirebaseMessaging/Sources/Token/FIRMessagingCheckinStore.m b/FirebaseMessaging/Sources/Token/FIRMessagingCheckinStore.m
index 5088f6c6aee..a9facf84b15 100644
--- a/FirebaseMessaging/Sources/Token/FIRMessagingCheckinStore.m
+++ b/FirebaseMessaging/Sources/Token/FIRMessagingCheckinStore.m
@@ -48,8 +48,8 @@ - (instancetype)init {
   self = [super init];
   if (self) {
     _plist = [[FIRMessagingBackupExcludedPlist alloc]
-        initWithFileName:kCheckinFileName
-            subDirectory:kFIRMessagingInstanceIDSubDirectoryName];
+        initWithPlistFile:kCheckinFileName
+             subDirectory:kFIRMessagingInstanceIDSubDirectoryName];
     _keychain =
         [[FIRMessagingAuthKeychain alloc] initWithIdentifier:kFIRMessagingCheckinKeychainGeneric];
   }
diff --git a/FirebaseMessaging/Tests/UnitTests/FIRMessagingBackupExcludedPlistTest.m b/FirebaseMessaging/Tests/UnitTests/FIRMessagingBackupExcludedPlistTest.m
index d0d77ff7007..c7da644004e 100644
--- a/FirebaseMessaging/Tests/UnitTests/FIRMessagingBackupExcludedPlistTest.m
+++ b/FirebaseMessaging/Tests/UnitTests/FIRMessagingBackupExcludedPlistTest.m
@@ -44,8 +44,8 @@ @implementation FIRMessagingBackupExcludedPlistTest
 - (void)setUp {
   [super setUp];
   [FIRMessaging createSubDirectory:kSubDirectoryName];
-  self.plist = [[FIRMessagingBackupExcludedPlist alloc] initWithFileName:kTestPlistFileName
-                                                            subDirectory:kSubDirectoryName];
+  self.plist = [[FIRMessagingBackupExcludedPlist alloc] initWithPlistFile:kTestPlistFileName
+                                                             subDirectory:kSubDirectoryName];
 }
 
 - (void)tearDown {
diff --git a/FirebaseMessaging/Tests/UnitTests/FIRMessagingCheckinStoreTest.m b/FirebaseMessaging/Tests/UnitTests/FIRMessagingCheckinStoreTest.m
index 12e16aa2c4c..094c7075aa8 100644
--- a/FirebaseMessaging/Tests/UnitTests/FIRMessagingCheckinStoreTest.m
+++ b/FirebaseMessaging/Tests/UnitTests/FIRMessagingCheckinStoreTest.m
@@ -67,8 +67,8 @@ - (void)setUp {
   [super setUp];
   [FIRMessaging createSubDirectory:kSubDirectoryName];
   self.checkinStore = [[FIRMessagingCheckinStore alloc] init];
-  self.plist = [[FIRMessagingBackupExcludedPlist alloc] initWithFileName:kFakeCheckinPlistName
-                                                            subDirectory:kSubDirectoryName];
+  self.plist = [[FIRMessagingBackupExcludedPlist alloc] initWithPlistFile:kFakeCheckinPlistName
+                                                             subDirectory:kSubDirectoryName];
   self.checkinStore.plist = self.plist;
 }
 
diff --git a/FirebaseMessaging/Tests/UnitTests/FIRMessagingTokenStoreTest.m b/FirebaseMessaging/Tests/UnitTests/FIRMessagingTokenStoreTest.m
index 97834f41f84..3afe323865d 100644
--- a/FirebaseMessaging/Tests/UnitTests/FIRMessagingTokenStoreTest.m
+++ b/FirebaseMessaging/Tests/UnitTests/FIRMessagingTokenStoreTest.m
@@ -76,8 +76,8 @@ - (void)setUp {
   [FIRMessaging createSubDirectory:kSubDirectoryName];
 
   self.checkinPlist =
-      [[FIRMessagingBackupExcludedPlist alloc] initWithFileName:kFakeCheckinPlistName
-                                                   subDirectory:kSubDirectoryName];
+      [[FIRMessagingBackupExcludedPlist alloc] initWithPlistFile:kFakeCheckinPlistName
+                                                    subDirectory:kSubDirectoryName];
 
   // checkin store
   FIRMessagingFakeKeychain *fakeKeychain = [[FIRMessagingFakeKeychain alloc] init];


Test patch: