React native 可能未经处理的承诺拒绝

React native 可能未经处理的承诺拒绝,react-native,agora.io,React Native,Agora.io,我们正在尝试使用Agora API和React Native发送摩尔斯电码,当我们处于启动通道时,它会工作,但一旦我们切换通道,它就会停止工作。 我们使用以下方法发送摩尔斯电码,并在您自己的设备上收听摩尔斯电码: engine.sendStreamMessage(dataStreamId, 'dash'); beep.setCurrentTime(9.7); beep.play(); 切换通道时,数据流ID保持不变。我们收到以下错误消息: Possible Unhandled Prom

我们正在尝试使用Agora API和React Native发送摩尔斯电码,当我们处于启动通道时,它会工作,但一旦我们切换通道,它就会停止工作。 我们使用以下方法发送摩尔斯电码,并在您自己的设备上收听摩尔斯电码:

engine.sendStreamMessage(dataStreamId, 'dash');
beep.setCurrentTime(9.7);
beep.play();
切换通道时,数据流ID保持不变。我们收到以下错误消息:

    Possible Unhandled Promise Rejection (id: 1):
Error: invalid argument
promiseMethodWrapper@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2242:45
sendStreamMessage@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:100044:47
dotMorsePressedFunc@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:98684:33
onPress@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:98876:46
onPress@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:69663:35
_performTransitionSideEffects@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:54930:22
_receiveSignal@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:54872:45
onResponderRelease@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:54781:34
invokeGuardedCallbackImpl@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:9137:21
invokeGuardedCallback@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:9231:42
invokeGuardedCallbackAndCatchFirstError@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:9235:36
executeDispatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:9307:48
executeDispatchesInOrder@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:9327:26
executeDispatchesAndRelease@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:10402:35
forEach@[native code]
forEachAccumulated@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:9469:22
runEventsInBatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:10426:27
runExtractedPluginEventsInBatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:10505:25
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:10481:42
batchedUpdates$1@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:21130:20
batchedUpdates@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:10388:36
_receiveRootNodeIDEvent@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:10480:23
receiveTouches@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:10533:34
__callFunction@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2765:36
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2497:31
__guard@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2719:15
callFunctionReturnFlushedQueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2496:21
callFunctionReturnFlushedQueue@[native code]

不清楚什么方法中的哪个参数无效?我们如何检查这一点?

如Agora文档createDataStream和sendStreamMessage返回承诺中所述。它们的类型声明为:

createDataStream(reliable: boolean, ordered: boolean): Promise<number>
sendStreamMessage(streamId: number, message: string): Promise<void>
var streamPromise = engine.sendStreamMessage(dataStreamId, 'dash')
streamPromise.then(() => { ...do something})
streamPromise.catch(error => ...handle error)