可能未处理的 Promise 拒绝(id:1)

问题描述 投票:0回答:1

我试图在 React Native 中使用来自 expo 的 Google API 身份验证,当我尝试登录 api 时,出现下一个错误:

代码:

import React, { createContext,useContext } from 'react'
import * as Google from 'expo-google-app-auth';


const AuthContext = createContext({})


const config = {
    androidClientId : 'APIKey',
    iosClientId: 'APIKey',
    scope: ["profile", "email"],
    premissions : ["public_profile", "email","gender","location"],
}

export const AuthProvider = ({ children }) => {
    
    const signInWithGoogle = async() => {
        Google.logInAsync(config).then(async (logInResults) => {
            if (logInResults.type === 'success') {
                // login...
          }
        });
    };

  return (
    <AuthContext.Provider
     value={{
        user:null,
        signInWithGoogle
    }}
    >
      {children}
    </AuthContext.Provider>
  )
}

export default function useAuth (){
    return useContext(AuthContext)
}

错误:

enter image description here

这个命令:

[未处理的承诺拒绝:错误:方法或属性 expo-app-auth.authAsync 在 ios 上不可用,您确定已正确链接所有本机依赖项吗?]

javascript react-native react-hooks expo google-authentication
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.