ios - Cordova ios 应用程序无法加载设备数据
<p><p>我搜索了很多关于我的问题并尝试了不同的解决方案,但它不起作用:/</p>
<p>链接我尝试过的内容:
<a href="https://stackoverflow.com/questions/30739473/nsurlsession-nsurlconnection-http-load-failed-on-ios-9" rel="noreferrer noopener nofollow">NSURLSession/NSURLConnection HTTP load failed on iOS 9</a> </p>
<pre><code>2016-06-24 10:51:56.760 <App Name> NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
</code></pre>
<p><strong>更新</strong></p>
<p>添加以下行后:</p>
<pre><code><key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</code></pre>
<p>我收到此错误:</p>
<pre><code>NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
</code></pre>
<p>但是当我跟着 <a href="https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33" rel="noreferrer noopener nofollow">developer apple</a> 的介绍一切都应该没问题:</p>
<p> <a href="/image/4bOoQ.png" rel="noreferrer noopener nofollow">nscurl --ats-diagnostics --verbose</a>结果</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我想通了。我必须在 <code>@implementation AppDelegate</code> 上方的 <code>Classes/AppDelegate.m</code> 中添加以下几行:</p>
<pre><code>@implementation NSURLRequest(DataController)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host{
return YES;
}
@end
</code></pre>
<p>我正在使用什么:</p>
<ul>
<li>cordova 5.3.3 版</li>
<li>平台:iio 4.2.0</li>
</ul>
<p>有用的链接:<a href="https://forum.ionicframework.com/t/solved-nsurlconnection-cfurlconnection-http-load-failed/29381" rel="noreferrer noopener nofollow">NSURLConnection/CFURLConnection HTTP load failed ionic</a> </p></p>
<p style="font-size: 20px;">关于ios - Cordova ios 应用程序无法加载设备数据,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/38009456/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/38009456/
</a>
</p>
页:
[1]