NSURLErrorDomain Code = -1012 Operation could not be completed

I get the following error when running my code from xcode.

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

Here is my code

  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, , .

- , , . [NSURLConnection sendAsynchronousRequest]. Xcode 6.1 ios 8.1.2

+4
2

kCFURLErrorUserCancelledAuthentication, -10xx CFNetworkErrors. . -

+2

.

[request setValue:self.misfitAccessToken forHTTPHeaderField:@"access_token" ];

+1

All Articles