Search code examples
iosobjective-cnsurlconnectionnsurlcredential

NSURLCredential is permanent?


We have a problem with our iPhone-simulator that was caused by using this line:

    Foo = [NSURLCredential CredentialWithUser:foo 
    password:bar persistance:NSURLCredentialPersistencePermanent];

The problem was created when the credential was given to the challenge over at

        -(NSURLConnection *)connection
        didReceiveAuthenticationChallenge(NSURLAuthenticationChallenge *)challenge
    {

        [[challenge sender]useCredential:Foo forAuthenticationChallenge:challenge]      
    }

So now when we run the application, we dont ever ever again run into the authenticationchallenge again, which is quite odd, even if we change the credential to

    Foo = [NSURLCredential CredentialWithUser:foo 
    password:bar persistance:NSURLCredentialPersistenceForSession];

or even

    Foo = [NSURLCredential CredentialWithUser:foo
    password:bar persistance:NSURLCredentialPersistenceNone];

To summarize:

By using credentialpersistencepermanent the credential is somehow saved somewhere and used automagically to access wherever we need to autenticate ourselves.

So for testing-purposes, we would really like to remove this persistent... credential.

Any ideas anyone? :)


Solution

  • Have you tried just resetting the simulator? It's in the Simulator menu.