-(NSMutableDictionary *)request:(NSString *)requestString {
NSString *filepath = [[NSBundle mainBundle] pathForResource:requestString ofType:@"xml"];
NSError *error = nil;
respString = [NSString stringWithContentsOfFile:filepath usedEncoding:nil error:&error];
NSLog(@"Ping xml");
tempDict = [[NSMutableDictionary alloc] initWithDictionary:[parser readXMLString:respString]];
NSLog(@"%@",tempDict);
return tempDict;
}
Until there, everything is ok, the NSLog is showing that there are 2 objects and keys in the tempDict.
But then:
-(int) authenticateUser {
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithDictionary:[self request:@"login"]];
if ([[dictionary objectForKey:@"sessionId0"] isEqualToString:@"-1"] ) {
//Some code
}
else {
cError = 1;
NSLog(@"%@",[dictionary objectForKey:@"sessionId0"]);
appDelegate.sessionId = [dictionary objectForKey:@"sessionId0"];
}
[dictionary release];
return cError;
}
At the last else, where cError is 1, NSLog outputs nil for that object.
(NSLog for the entire dictionary also outputs nil)
Place this code in your and see what the output is for dict object…