在Amplify中调用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.currentAuthenticatedUser函数并从Cognito返回用户。
放大版本:1.1.22
答案 0 :(得分:0)
问题解决了。
在函数调用中添加.catch可解决该错误:
Auth.updateUserAttributes(user, { 'custom:token': token } )
.then(result =>{ console.log(result)})
.catch(err => console.log(err));