[英]https fetch request blocking in android and ios - React Native
I build one mobile app using React Native, 我使用React Native构建了一个移动应用,
In that i am using one api to fetch data, initially i have one web api in http, for example like this: http://example.com it successfully fetch data in android but not in ios, 因为我使用一个api来获取数据,所以最初我在http中有一个web api,例如: http : //example.com,它在android中成功获取了数据,但在ios中却没有,
I read apple docs then i found apple needs https for production apps, 我读了苹果文档,然后发现苹果生产应用需要https,
So i decided and change my web api protocol to https like this: https://example.com , after changing my api successfully i got response in web page when i hit that url, but now when i am running my React Native application it tells me Network Request Failed 所以我决定将我的Web api协议更改为https,例如: https : //example.com ,成功更改我的api后,当我点击该URL时,我在网页中得到响应,但是现在当我运行React Native应用程序时告诉我网络请求失败
I also change my http to https in my React Native fetch request code. 我也在我的React Native获取请求代码中将http更改为https。 I dont know whats the problem is, Is this React Native issue?
我不知道问题是什么,这是React Native问题吗?
https is not enough for iOS. 对于iOS,https还不够。 Your SSL certificate should be in compliance with TSL 1.2 or major by default.
默认情况下,您的SSL证书应符合TSL 1.2或主要标准。
You can override this behavior setting the minimum supported TSL in the info.plist file as follow: 您可以覆盖此行为,如下所示,在info.plist文件中设置支持的最低TSL:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>example.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.0</string>
</dict>
</dict>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.