- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的应用程序的 UIWebView 中加载 youku.com 视频时遇到问题。我很确定这是由于应用程序传输安全性,因为用 HTTPS URL 替换嵌入可以正常工作。当然,没有 HTTPS 等效 URL,因为中国。
我已经阅读了各种 NSAppTransportSecurity 设置。我的第一直觉当然是尝试使用 NSAllowsArbitraryLoads 来至少验证问题,但这并没有奏效。然后我按照各种在线指南展示了如何像你应该做的那样使用 NSExceptionDomains,但这也不起作用。
现在我被困住了。 FWIW,我正在捕获这样的 URL 加载错误:
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
...
if (error.code == NSURLErrorCancelled)
{
NSLog(@"NSURLErrorCancelled: URL %@ error %@", urlString, error);
}
}
2015-12-02 15:47:22.312 ZaoMengShe[81707:903426] NSURLErrorCancelled: URL https://dev1.zaomengshe.com/c/54260 error Error Domain=NSURLErrorDomain Code=-999 "(null)" UserInfo={NSErrorFailingURLKey=http://exon.name/, NSErrorFailingURLStringKey=http://exon.name/}
最佳答案
事实证明 NSAllowsArbitraryLoads 在这种情况下工作正常。我的问题是我遇到了另一个限制。在新的安全策略中,您不能在安全 (HTTPS) 页面中加载不安全 (HTTP) 事件内容。在浏览器和 UIWebView 中都是如此。似乎没有任何方法可以关闭此行为。
这是一些额外的日志,用于显示关闭然后打开 NSAllowsArbitraryLoads 的错误消息。无论哪种方式,它都会失败,但在第一种情况下我会收到一条额外的错误消息:
2015-12-07 17:58:10.589 TestWeb[13583:4566542] about to load url https://dev1.zaomengshe.com/c/54260
2015-12-07 17:58:15.966 TestWeb[13583:4569606] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
2015-12-07 17:58:16.045 TestWeb[13583:4566542] failed to load
2015-12-07 17:58:40.879 TestWeb[13583:4566542] NSURLErrorCancelled: error Error Domain=NSURLErrorDomain Code=-999 "(null)" UserInfo={NSErrorFailingURLKey=http://exon.name/, NSErrorFailingURLStringKey=http://exon.name/}
2015-12-07 17:58:40.895 TestWeb[13583:4569023] void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
2015-12-07 17:58:41.878 TestWeb[13583:4569606] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-12-07 17:58:41.884 TestWeb[13583:4566542] finished load urlString: https://dev1.zaomengshe.com/c/54260
2015-12-07 17:54:57.431 TestWeb[13503:4532874] about to load url https://dev1.zaomengshe.com/c/54260
2015-12-07 17:55:02.339 TestWeb[13503:4532874] failed to load
2015-12-07 17:55:15.310 TestWeb[13503:4532874] NSURLErrorCancelled: error Error Domain=NSURLErrorDomain Code=-999 "(null)" UserInfo={NSErrorFailingURLKey=http://exon.name/, NSErrorFailingURLStringKey=http://exon.name/}
2015-12-07 17:55:15.313 TestWeb[13503:4533886] void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
2015-12-07 17:55:16.210 TestWeb[13503:4534307] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9843)
2015-12-07 17:55:16.653 TestWeb[13503:4532874] finished load urlString: https://dev1.zaomengshe.com/c/54260
关于ios - 如何调试 NSAllowsArbitraryLoads 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34037527/
我有一个可以从 http 域下载一些信息的工作应用程序。但是在 Swift 2.0 和 Xcode 7 更新后,我的应用程序无法连接到服务器并下载 json 数据,我收到“应用程序传输安全已阻止明文
我在我的应用程序的 UIWebView 中加载 youku.com 视频时遇到问题。我很确定这是由于应用程序传输安全性,因为用 HTTPS URL 替换嵌入可以正常工作。当然,没有 HTTPS 等效
到目前为止,我们只在应用程序的 ATS 设置中设置了 NSAllowsLocalNetworking。 但是,现在我们的聊天功能中引入了链接预览。用户发布的链接用于创建包含链接网页图像和网站图标的预览
我不精通 SSL/TLS/服务器证书或 iOS,但我想确认一些有关 iOS 9 和 NSAllowsArbitraryLoads 标志的事情。 在 iOS 9 上,最低版本是否需要 TLS1.2? 将
我正在尝试让我的应用程序通过 Apple Transport Security 连接到 152.111.198.244 的 http 服务器。我正在尝试的任何东西都不起作用。 将 NSAllowsAr
曾经有一种方法可以解决 iOS 对具有有效证书的 HTTP 的坚持。我对在这种状态下将应用程序提交到商店不感兴趣,我只想在开发应用程序时与 Charles 一起嗅探网络操作。 谢谢 我试过了 NSAp
我是 swift 的新手,我正在尝试弄清楚如何将一些 POST 请求发送到具有自签名证书的服务器。我现在正在尝试访问开发服务器进行测试。这就是我实现 didReceive 挑战函数的方式: func
我正在快速开发一个正在写入数据库的应用程序。但是我正在使用以下解决方案来传输数据 引用:/image/QSnGS.png 本应用仅供我公司6人左右使用,但需经过apple控制。你认为,它可以通过控制吗
我升级到 Xcode 7.0.1,其中项目以 iOS 9 为目标。如果我想允许 RESTful API 与 HTTP,我应该使用 NSExceptionAllowsInsecureHTTPLoads
这个问题在这里已经有了答案: Does App Store reject submission if NSAllowsArbitraryLoads set to YES? (6 个答案) 关闭 6
这个问题在这里已经有了答案: Does App Store reject submission if NSAllowsArbitraryLoads set to YES? (6 个答案) 关闭 6
新ATS涉及 iOS 9 导致许多与 http 相关的功能停止工作。我必须将所有 http 请求 url 添加到白名单中,或者我可以通过将 NSAllowsArbitraryLoads 设置为 YES
使用 Unity 制作适用于 iOS 和 Android 的应用。 我现在陷入了一个 iOS 问题: You are using download over http. Currently unity
我是一名优秀的程序员,十分优秀!