更新时间:2023-02-04 09:14:10
Alert.alert 接收到一个字符串,而您从 fetch 响应中得到的内部是一个 com.facebook.react.bridge.ReadableNativeMap
对象(这是 fetch 的本机实现返回的内容).你可以试试:
Alert.alert receives an string, and what you're getting from the fetch response is internally a com.facebook.react.bridge.ReadableNativeMap
object (which is what the native implementation for fetch returns).
You can try:
Alert.alert(JSON.stringify(responseJson))
如果你使用的是 iOS,你会得到一个完全不同的错误:
If you were using iOS you'll get a completely different error:
Exception '-[_NSFrozenDictionaryM length]: unrecognized selector ...