使用此代码:
handleShortCapture = async () => {
try {
const photoData = await this.camera.takePictureAsync();
this.setState({ capturing: false, captures: [photoData, ...this.state.captures] })
} catch (e) {
ToastAndroid.show(e)
}
const shibeAmount = Math.floor(Math.random() * 3 + 1);
Speech.speak(`shibe amount: ${shibeAmount}`)
try {
const shibes = await fetch(`https://cors-anywhere.herokuapp.com/https://shibe.online/api/shibes?count=${shibeAmount}urls=false&httpsUrls=false`)
const jsonShibes = await shibes.json()
Speech.speak(jsonShibes.length)
} catch(e) {
Speech.speak(e.message)
}
};
我可以听到 shibe金额短语,但是听不到 fetch 请求的响应;我想念什么?