NSURLConnection完成,错误-代码--1002 [英] NSURLConnection finished with error - code -1002
问题描述
朋友,我有可以播放音频流的简单音频播放器(MPMoviePlayerController).在iOS 11上,我遇到了麻烦,上千次出现错误,我的流停止了:
Friends i have simple audio player (MPMoviePlayerController) which can play audio stream. On iOS 11 i have very interessing trouble, thousand time i have error and my stream was stopped:
NSURLConnection finished with error - code -1002
我粘贴了这段代码(我在stackowerflow上看到的这段代码),但这对我没有帮助:
I paste this code (this code i saw on stackowerflow) but it's not help to me:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>cast.mysite.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
也许您知道最佳解决方案?
Maybe you know best solution?
推荐答案
该错误应该不与使用HTTP而不是HTTPS有关. App Transport Security失败返回错误代码-1022.
That error should not be related to using HTTP instead of HTTPS. App Transport Security failures return error code -1022.
错误代码-1002表示无效的URL.也许您的HTTP实时流播放列表文件包含结构上无效的URL(例如,丢失的方案,http/https以外的方案等)?
The error code -1002 indicates an invalid URL. Perhaps your HTTP live streaming playlist file contains a structurally invalid URL (e.g. missing scheme, a scheme other than http/https, etc.)?
要进行其他调试,请设置此环境变量
For additional debugging, set this environment variable
CFNETWORK_DIAGNOSTICS=1
在您的Xcode项目中
并重新运行该应用程序.一旦知道什么URL失败了,问题就可能变得更加明显.
in your Xcode project and re-run the app. Once you know what URL is failing, the problem will likely become more obvious.
如果不是,请提交错误.
If it isn't, file a bug.
这篇关于NSURLConnection完成,错误-代码--1002的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!