Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
NSURLErrorDomain -1012 with NSURLAuthenticationChallenge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURLErrorDomain -1012 with NSURLAuthenticationChallenge



Hi people!
I trying to connect with NSUrlConnection that works fine with normal sites
like my blog, but if I try to use something with authentication like
delicious's api i get this error:

Error NSURLErrorDomain -1012

The delegate method:

-(void)connection:(NSURLConnection *)connection
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
  NSLog(@"Ask for authorization");
   if ([challenge previousFailureCount] == 0) {
     NSLog(@"defaults credentialt");
       NSURLCredential *newCredential;
       newCredential = [NSURLCredential credentialWithUser:@"xxxx"
                                                password:@"xxxxx"

persistence:NSURLCredentialPersistenceNone];

     [[challenge sender] useCredential:newCredential
              forAuthenticationChallenge:challenge];

   } else {
     NSLog(@"Something fail = %d", [challenge previousFailureCount]);
       [[challenge sender] cancelAuthenticationChallenge:challenge];

   }
}


With safari the connection works good, but with the same url my code miss. Thanks in advance.

Cheers

--
Karim Gorjux
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.