IOS 上的 react-native-twitter Oath URLSearchParams 错误

react-native-twitter Oath URLSearchParams Error on IOS

目前正在 IOS 应用程序 RN 0.61.1 上实现 Twitter 的 API 并使用 react-native-twitter, library but am running into problems following the example on github.

点击授权按钮returns出错。预期的结果应该是弹出一个浏览器页面,允许用户通过应用程序授予对 Twitter 的访问权限。

我发现 react-native 和 OAuth 存在类似问题,但 none 的建议对我有效。

在Debugger:ERROR

setUpDeveloperTools.js:73 Possible Unhandled Promise Rejection (id: 0): Error: not implemented Error: not implemented at URLSearchParams.get (http://localhost:8081/index.delta?platform=ios&dev=true&minify=false&revisionId=306550084ac919f0:40695:15...

如有任何建议,我们将不胜感激。

不确定是否允许这样做,但我编辑了模块本身,因为它在 index.js 中不起作用。

通过调试器找到 auth() 函数并更改 URLSearchParams 导入。

//in ./node_modules/react-native-twitter/src/oauth/auth.js 

//from
import URLSearchParams from 'url-search-params';


//to
import {URLSearchParams } from 'whatwg-url';
import { Buffer } from 'buffer';
global.Buffer = Buffer;

建议here