Lak*_*kar 13 ios react-native react-native-ios
我试图在我的react-native应用程序中使用react-native-fbsdk.它一直很好,直到昨天.但是,今天它给出了一个奇怪的错误,说明RCTJSONStringify()遇到以下错误:JSON写入(NSURL)中的类型无效.
RN v0.42.0
这是我的代码:
_fbAuth(error, result) {
if (error) {
console.log("error");
alert("login has error: " + result.error);
} else if (result.isCancelled) {
console.log("login cancelled");
alert("login is cancelled.");
} else {
AccessToken.getCurrentAccessToken().then((data) => {
console.log("login success");
console.log(data.accessToken.toString());
let accessToken = data.accessToken;
alert(data.accessToken.toString());
const responseInfoCallback = (error, result) => {
if (error) {
console.log(error);
} else {
console.log(result);
}
}
const infoRequest = new GraphRequest(
'/me',
{
accessToken: accessToken,
parameters: {
fields: {
string: 'email,name,first_name,middle_name,last_name'
}
}
},
responseInfoCallback
);
// Start the graph request.
new GraphRequestManager().addRequest(infoRequest).start();
});
}
}
render() {
console.log("in new render");
return (
<View style={styles.container}>
<LoginButton
publishPermissions={["publish_actions"]}
onLoginFinished={this._fbAuth}
onLogoutFinished={() => alert("logout.")}/>
</View>
);
}
Run Code Online (Sandbox Code Playgroud)
调试器中打印的错误信息:
我在函数responseInfoCallback中调用graphAPI时遇到上述错误.有什么想法发生了什么?
更新1:
仅当远程调试器打开时才会发生此错误!否则它不会发生.但是没有远程调试器,我无法继续开发应用程序.除了远程调试器之外,还有其他方法可以查看react-native app的日志语句吗?
更新2:
RCTJSONStringify()错误仅发生在代理后面.并且https fetch调用在代理下也不起作用.我在一个开放的网络中测试过,它运行正常.我想,它是向RN app添加一些代理信息.我认为它与APP传输安全性有关
| 归档时间: |
|
| 查看次数: |
1466 次 |
| 最近记录: |