iOS 模拟器不支持此浏览器

This Browser is not supported in iOS simulator

我在 iOS 模拟器中 This Browser is not supported 的 react-native 中遇到错误,在 运行 以下代码之后:

const firebase = require('firebase')
const firebaseConfig = require('./firebase-config')
firebase.initializeApp(firebaseConfig)

firebase.database().ref('test').set('hello')

firebase-config 包含一个数据库 URL。

为什么?

这里是 Firebaser

由于对 window 对象的依赖,新的 Firebase 身份验证目前在 React Native 中不起作用。我们正在寻找是否可以改进,但不能保证。

来自Jacob's post on the firebase-talk list

As a "workaround" if you don't need auth (unlikely, I know, but still worth mentioning), you should be able to do the following:

var app = require('firebase/app');
var database = require('firebase/database');

显然,新的 Firebase Javascript 客户端库依赖于 localStorage,因此在某些情况下无法启动,例如处于隐私浏览模式的 Safari。

作为解决方法,我将新客户端库的补丁版本上传到 github: https://github.com/urish/firebase-localstorage-fix/blob/master/firebase.js

我希望团队能尽快解决这个问题,但与此同时,补丁版本对我有用。