Hello! I am struggling over this for like 2/3 days now, and i-can-not-figure-it-out!!
I am using the twitter api, and want to let the user know if his given information (username, password) is correct or incorrect..
Code:
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
if ([challenge previousFailureCount] == 0) {
NSURLCredential *newCredential;
newCredential=[NSURLCredential credentialWithUser:[self username] password:[self password] persistance:NSURLCredentialPersistanceNone];
[[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge];
} else {
[[challenge sender] cancelAuthenticationChallenge:challenge];
NSLog(@"Wrong username/password!");
}
}
The problem is, the
else never gets called!
I read somewhere that the use of a # at the end of the url works, but didn't do anything for me...
Is there anyone that knows what I have to do???