在呼叫updateUserAttributes时,我会收到以下错误:
2019-03-13 08:31:18.937 25019-25057 E/ReactNativeJS: undefined is not a function (evaluating 'Object.keys(styles)[typeof Symbol === "function" ? Symbol.iterator : "@@iterator"]()')
2019-03-13 08:31:18.942 25019-25057 E/ReactNativeJS: undefined is not a function (evaluating '_$$_REQUIRE(_dependencyMap[2], "pretty-format")(error)')
呼叫代码看起来像这样:
const user = await getCurrentAuthenticatedUser();
Auth.updateUserAttributes(user, { 'custom:token': token } ).then(result =>{ console.log(result)});
getCurrentAuthentIcateDuser包装auth.currentauthenticatecateDuser函数,并从cognito返回用户。
放大版本:1.1.22
解决问题。
在函数调用中添加.CATCH解决错误:
Auth.updateUserAttributes(user, { 'custom:token': token } )
.then(result =>{ console.log(result)})
.catch(err => console.log(err));