我正在使用react-native-static-server在本地运行HTML游戏并将其呈现在WebView中。它可以在android物理设备上正常工作,但对于iOS,启动服务器时出现以下错误:
TypeError:无法读取未定义的属性“开始”
此错误位于:RocketView中(位于 DownloadedGameView.js:54)...
这是错误所涉及的部分:
从“ react-native-static-server”导入StaticServer;
startServer(){ this.server = new StaticServer(0,this.props.localPath,{ localOnly:true });
this.server.start().then(url => { this.setState(prevState => { if (!prevState.source) prevState.source = {}; prevState.source = { uri: url + '/' + this.props.htmlName }; prevState.serverReady = true; return prevState; }); }); }
并且控制台上出现以下错误:
错误:未打开 在WebSocket.send(/Users/tavo.parra/Documents/Development/discovery/discovery-kids-app/dkidsworld/node_modules/ws/lib/WebSocket.js:219:16) 发送时(/Users/octavio.parra/Documents/Development/discovery/discovery-kids-app/dkidsworld/node_modules/react-native/local-cli/server/util/webSocketProxy.js:26:12) 在WebSocket.debuggerSocket.onmessage(/Users/octavio.parra/Documents/Development/discovery/discovery-kids-app/dkidsworld/node_modules/react-native/local-cli/server/util/webSocketProxy.js:48:48) 在WebSocket.onMessage(/Users/octavio.parra/Documents/Development/discovery/discovery-kids-app/dkidsworld/node_modules/ws/lib/WebSocket.js:442:14) 在emitTwo(events.js:126:13) 在WebSocket.emit(events.js:214:7) 在Receiver.ontext(/Users/octavio.parra/Documents/Development/discovery/discovery-kids-app/dkidsworld/node_modules/ws/lib/WebSocket.js:841:10) 在/Users/octavio.parra/Documents/Development/discovery/discovery-kids-app/dkidsworld/node_modules/ws/lib/Receiver.js:536:18中 在/Users/octavio.parra/Documents/Development/discovery/discovery-kids-app/dkidsworld/node_modules/ws/lib/Receiver.js:368:7中 在/Users/octavio.parra/Documents/Development/discovery/discovery-kids-app/dkidsworld/node_modules/ws/lib/PerMessageDeflate.js:249:5
关于如何解决此问题的任何想法?我没有找到任何相关信息,并且已经为此苦苦挣扎了几天