ios - 任务.<0> HTTP 加载失败,0/0 字节(错误代码:-1200 [3:-9858])
问题描述
我在我的应用程序中使用上传图片的功能。应用程序使用 SOAP 请求将图像发送到服务器。最近我将网址从 http 设置为 https,我遇到了这个问题,
任务 .<0> HTTP 加载失败,0/0 字节(错误代码:-1200 [3:-9858])
NSURLConnection 完成错误 - 代码 -1200
我已经尝试了 info.plist 中的所有更改,但它不起作用。请你帮助我好吗?谢谢
解决方案
好吧,看看这个...
if ([challenge.protectionSpace.authenticationMethod
isEqualToString:NSURLAuthenticationMethodServerTrust])
[challenge.sender useCredential:[NSURLCredential
credentialForTrust:challenge.protectionSpace.serverTrust]
forAuthenticationChallenge:challenge];
[challenge.sender
continueWithoutCredentialForAuthenticationChallenge:challenge];
我认为应该是
if ([challenge.protectionSpace.authenticationMethod
isEqualToString:NSURLAuthenticationMethodServerTrust])
[challenge.sender useCredential:[NSURLCredential
credentialForTrust:challenge.protectionSpace.serverTrust]
forAuthenticationChallenge:challenge];
else // you need to add an else here
[challenge.sender
continueWithoutCredentialForAuthenticationChallenge:challenge];
编辑
另外,我看到您将 URL 指定为
https://pro-ap.com.au/Mobile/profilepic.asmx?
删除最后一个问号,因为它是请求的一部分,将在构建请求时自动附加。
推荐阅读
- php - 从 php Mysqli_query 运行自定义 Mysql 函数返回未定义索引错误
- python - 将 GridSearchCV 结果传递给 Imbalanced-Learn 的 Pipeline 对象
- ruby - 为什么我在 ruby ruport 中出现“未初始化的常量”错误
- python - 使用 python yum API 进行通配符搜索
- javascript - 如何使用 react 和 node.js 在网站上制作动态内容
- laravel - 将变量从 Controller 传递到 View Laravel 5.8 时出错
- python - 虽然循环运行太多次?
- javascript - 为什么排序/过滤不适用于此实时数据库查询?
- c# - Mono 5.20.1(在 Windows 操作系统上)中的 String.Split 方法是否损坏?
- bash - 如何在没有 for 循环的情况下复制关联数组