NSURLErrorDomain代码=

编程入门 行业动态 更新时间:2024-10-19 14:33:51
本文介绍了NSURLErrorDomain代码= -1012无法完成该操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

从xcode运行代码时,出现以下错误.

I am getting the following error when running my code from the xcode.

Error Domain = NSURLErrorDomain代码= -1012操作无法完成.(NSURLErrorDomain错误-1012.)" UserInfo = 0x17166b740 {NSErrorFailingURLStringKey = ..../move/resource/v1/user/me/activity/summary?start_date = 2015-01-21& end_date = 2015-01-14& detail = true , NSUnderlyingError = 0x17405b630该操作无法完成. (kCFErrorDomainCFNetwork错误-1012.)", NSErrorFailingURLKey = ..../move/resource/v1/user/me/activity/summary?start_date = 2015-01-21& end_date = 2015-01-14& detail = true }

Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0x17166b740 {NSErrorFailingURLStringKey=..../move/resource/v1/user/me/activity/summary?start_date=2015-01-21&end_date=2015-01-14&detail=true, NSUnderlyingError=0x17405b630 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)", NSErrorFailingURLKey=..../move/resource/v1/user/me/activity/summary?start_date=2015-01-21&end_date=2015-01-14&detail=true}

这是我的代码

NSString *urlSummaryString = [[NSString stringWithFormat: @"%@summary?start_date=%@&end_date=%@&detail=true", kMisfitCloudEndpoint, strStartDate,strEndDate] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; __block NSMutableDictionary *responseDict = [NSMutableDictionary dictionary]; __block NSError *error = nil; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlSummaryString] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0]; [request setValue:@"access_token" forHTTPHeaderField:self.misfitAccessToken]; [request setHTTPMethod:@"GET"]; [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { if(connectionError){ // Handle the connection error return ; }}];

任何人都可以帮助我这里有什么问题吗?它与服务器上的SSL证书有关吗,并且与安全性有关.当我使用CocoaRestClient发出请求时,它可以正常运行.

Can any one help me what is wrong here. Is it something related to SSL Certificate on the server and is related to the security. When I use CocoaRestClient to make my request it works perfectly.

有人可以详细解释一下导致此问题的原因吗,或者是否有任何机构可以解决此问题.我必须使用[NSURLConnection sendAsynchronousRequest]方法.我正在使用Xcode 6.1和ios 8.1.2

Can some body explain me in detail what cause this problem or if any body can have the solution for this. I have to use [NSURLConnection sendAsynchronousRequest] method. I am using Xcode 6.1 and ios 8.1.2

推荐答案

这是 kCFURLErrorUserCancelledAuthentication 错误, -10xx错误属于 CFNetworkErrors 枚举. 这个常数的名字很不言而喻.服务器由于某种原因取消了身份验证

This is kCFURLErrorUserCancelledAuthentication error, -10xx errors are of the CFNetworkErrors enum. Name of this constant is pretty selfexplanatory. Server cancelled authentication for some reason

更多推荐

NSURLErrorDomain代码=

本文发布于:2023-11-26 18:16:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634655.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   NSURLErrorDomain

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!