On 12 Nov 2009, at 08:43, Roland King wrote:
> are you definitely receiving a challenge the *second* time you run the app?
> It is possible that the server sends a cookie representing the login which
> the phone has now cached and is sending along with the request
> (automatically) which is failing the login.
Yes, I receive the challenge. In fact, after initially spotting the problem, I
implemented:
- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection
{
return NO;
}
so in fact, I'm now seeing the challenge on each login attempt.
> One thing you could try to see if it's that is to find the cookie storage on
> startup and clean it out explicitly. That might then make the server do the
> challenge again.
When I try:
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage]
cookiesForURL:[NSURL URLWithString:@"www.some.url"]];
at application startup I receive an empty array, so it doesn't look like any
cookies are being stored.
...
Hmmm, and now I can change accounts without problems. I'll test some more, but
the most likely scenario is I was cooked when I was recently testing this.
Thanks for the suggestions Roland. I wasn't aware of NSHTTPCookie and
NSHTTPCookieStorage, so at least I picked up some new info. If I run into
trouble again with this, I'll follow up on this thread.
Cheers,
António
----------------------------------------------------
It is better to light a candle than to curse the darkness
----------------------------------------------------
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]