我是React Native和Firebase的新用户,当我在实际设备上测试我的应用程序而不是模拟器时,我遇到了问题。
这就是我正在测试的内容:
他们正在共享同一个数据库,所以我有点困惑为什么会发生这种情况。它在我的模拟器上运行得很好,但在实际设备上却没有。任何帮助表示赞赏!
这是我的身份验证码:
export const loginUser = ({ email, password }) => {
return (dispatch) => {
dispatch({ type: LOGIN_USER });
firebase.auth().signInWithEmailAndPassword(email, password)
.then(user => loginUserSuccess(dispatch, user))
.catch(() => loginUserFail(dispatch));
//.catch((error) => { console.log(error); });
//console.log(error);
/*firebase.auth().createUserWithEmailAndPassword(email, password)
.then(user => loginUserSuccess(dispatch, user))
.catch(() => loginUserFail(dispatch)); */
};
};
//for register view create a user
export const createUser = ({ email, password }) => {
return (dispatch) => {
dispatch({ type: CREATE_USER });
firebase.auth().createUserWithEmailAndPassword(email, password)
.then(user => loginUserSuccess(dispatch, user))
.catch(() => loginUserFail(dispatch));
//.catch((error) => {
//console.log(error);
/*firebase.auth().createUserWithEmailAndPassword(email, password)
.then(user => loginUserSuccess(dispatch, user))
.catch(() => loginUserFail(dispatch)); */
};
};