Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Can';t使用react native连接到推进器_Javascript_React Native_Error Handling_Pusher_Pusher Js - Fatal编程技术网

Javascript Can';t使用react native连接到推进器

Javascript Can';t使用react native连接到推进器,javascript,react-native,error-handling,pusher,pusher-js,Javascript,React Native,Error Handling,Pusher,Pusher Js,您好,我是react native新手,我正在尝试使用pusher js创建一个实时聊天应用程序,因此我安装了包npm install pusher js@react native community/netinfo,并将以下代码放入我的useEffect中 useEffect(() => { // Enable pusher logging - don't include this in production Pusher.logToConsole = true;

您好,我是react native新手,我正在尝试使用pusher js创建一个实时聊天应用程序,因此我安装了包npm install pusher js@react native community/netinfo,并将以下代码放入我的useEffect中

useEffect(() => {
    // Enable pusher logging - don't include this in production
    Pusher.logToConsole = true;

    var pusher = new Pusher('REDACTED', {
        cluster:"eu"});

    var channel = pusher.subscribe('my-channel');
    channel.bind('my-event', function(data) {
        alert(JSON.stringify(data));
    });
    
}, [])
我把这个放在控制台里

Im使用react native run android运行,Im使用物理设备。
提前感谢您提供的所有帮助。

您是否已为应用程序授予访问网络所需的权限?为此,您需要添加

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

到你的android清单。
请参阅

我已经删除了您的应用程序键。您还应该考虑在推板仪表板中旋转键以防止未授权的用户。TNX现在正在工作。您的答案是解决方案的一部分。我也禁用调试器,使其工作。