Comments (7)
expo的麻烦就在于你不能更改原生配置,只能等官方发布新版本
看起来官方是在sdk33中修复了 expo/expo@fdc6a3a
from react-native-website.
鱼和熊掌不可兼得?看来expo还不是很完美,还是用react-native init吧
from react-native-website.
记录一下,新建一个reactNative项目后将参数格式改为:
即key=value的形式后请求成功。没有对android目录内容进行任何配置。
网上解决这个问题的其他方向有:
1、虚拟机的dns要和本机的dns保持一致;
2、需要配置相应平台的网络设置,如ios对http的限制,android也存在类似的问题
from react-native-website.
- content-type任何形式,与http协议、系统本身对http协议的限制没有任何关系,不可能解决其相关的问题。好比你打电话的音量大小,不可能影响你的话费多少。
- content-type具体用什么格式,由服务器决定,它要json格式要xml格式要kv格式,你都得听它的。
from react-native-website.
我认为问题出在传参上,Content-Type: application/x-www-form-urlencoded这种格式要求参数以key=value的方式传入;我一开始用的FormData也是k-v格式,正常来说我这样传参是没问题的,但还是出错了。我找到的解释是:FormData.append方法只能在Web Workers 中使用:
就是因为这个出现了TypeError: Network request failed错误。
from react-native-website.
你的理解还是错误的,
1、form data对应的是multipart/form-data,而不是application/x-www-form-urlencoded
2、form data在web workers中可用,当然不是“只能”。如果是这样,谁还用form data?
from react-native-website.
明白了 谢谢
from react-native-website.
Related Issues (20)
- 按照官方文档搭建开发环境,编译应用的时候一直报错 HOT 8
- upload ipa to appconnect but have issue HOT 2
- React Native +Expo SDK51实现自定义下拉刷新效果 HOT 1
- 想要实现编程式重启应用程序
- 相机录像问题 HOT 2
- 关于ios和android端启动页编辑可否有教程指引?
- react-native run-android卡住 HOT 1
- 根据官网搭建环境,创建项目,yarn iOS报错 HOT 11
- RN 0.70.0版本 需要 Ruby2.7.5,但是总是安装失败。 HOT 8
- 版本兼容问题?Task :react-native-screens:configureCMakeDebug[arm64-v8a] FAILED HOT 5
- gradle 8.6在windows下可能存在bug,需降级到8.5 HOT 16
- 根据官网安装的环境无法调试应用 HOT 2
- exec format error HOT 1
- cannot execute binary file
- rn+taro开发app偶发出现 Error: Exception in HostFunction: Malformed calls from JS: field sizes are different报错
- yarn ios报错 HOT 2
- 初始化项目,运行时报错,报错如内容所述(急 急 急)
- Mac 求助 bundle install 发生错误
- 执行 bundle exec pod install报错 HOT 3
- 创建项目报错:Copying template error HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-website.