react-native-firebase (v6):使用辅助应用程序时,应用程序在 ios 上崩溃,在 Android 上运行正常

react-native-firebase (v6): App is crashing on ios when using secondary app, works fine on Android

package.json-

"@react-native-firebase/app": "8.3.1",
"@react-native-firebase/auth": "8.3.3",
"@react-native-firebase/firestore": "7.5.3",

初始化-

export const initGuestChatConnection = async () => {
  // DEFAULT app will always be there
  if (firebase.apps.length < 2) {
    await firebase.initializeApp(
      GUEST_CHAT_FIREBASE_CONFIG,
      GUEST_CHAT_FIREBASE_CONFIG.app_name
    );
  }
};

获取辅助应用程序实例的包装器方法-

export const getGuestChatFirebaseInstance = () => {
  return firebase.app(GUEST_CHAT_FIREBASE_CONFIG.app_name);
};

当我们尝试使用 auth (custom signin) 时,我们得到以下错误-

Exception '*** -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil' was thrown while invoking addAuthStateListener on target RNFBAuthModule with params (
    "GUEST_CHAT"
)

我们的登录方式-

export const signInGuestChatFirebaseInstance = token => {
  return getGuestChatFirebaseInstance()
    .auth()
    .signInWithCustomToken(token);
};

我们认为问题出在身份验证上,所以我们跳过它并尝试直接访问 Firestore(通过修改 Firestore 规则),但随后我们开始收到以下错误 -

Exception 'FirebaseApp instance may not be nil. Use FirebaseApp.app() if you'd like to use the default FirebaseApp instance.' was thrown while invoking collectionOnSnapshot on target RNFBFirestoreCollectionModule with params (
    "GUEST_CHAT",

这在 Android 上运行良好。这些方法在 ios 上也适用于 DEFAULT Firebase 应用程序,但由于某种原因它在辅助应用程序上崩溃。

为次要项目创建 iOS 应用程序以使其正常工作。由于在添加 iOS 应用程序时它提供了 GoogleService-info.plist,因此从 GoogleService-info.plist 中提取所有配置相关信息并使用它来创建用于初始化第二个应用程序的配置。这将使辅助应用程序在 iOS!

上运行