I'm doing a parsing of a XML and my problem begins when i want to store a NSData of an url needed for my parser. This URL contains the user and the password to authenticate (returns a XML), and in my first UIview it's checked this values. Everything is alright and it's properly authenticated, but once is authenticated if I change the password, the url changes but the corresponding nsdata is stored like before, i.e.:
First time: correct user+correct pass = correct access.
Second time: correct user + incorrect pass = correct access
Also:
First time: correct user + incorrect pass = incorrect access
Second time: correct user + correct pass = incorrect access
It's like the first password was retained and the connection maybe is still aliveā¦so i don't know if I would have to change the default headers of the HTTP...help please!
Here is the code:
-(id) loadXMLByURL: (NSString *)urlString {
NSURL *url = [NSURL URLWithString: urlString]; //The URL changes correctly
NSMutableData *data = [[NSMutableData alloc] initWithContentsOfURL:url]; //Here is the problem
parser = [[NSXMLParser alloc]initWithData:data];
parser.delegate = self;
[parser parse];
return self;
}