I am currently struggeling why the following code doesnt log my used NSString.
-(BOOL)login:(NSString *)email withPassword:(NSString *)password error:(NSError *__autoreleasing *)error
{
__block BOOL success = NO;
if (*error)
return success;
__block NSString *domain = @"de.FranzBusch.Searchlight.ErrorDomain";
__block NSError *localerror = nil;
//HTTP Request
NSURL *url = [NSURL URLWithString:@"Wrong URL to test the failure block"];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:url];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
email, @"email",
password, @"password", nil];
NSMutableURLRequest *request = [client requestWithMethod:@"POST" path:@"" parameters:params];
AFKissXMLRequestOperation *operation = [AFKissXMLRequestOperation XMLDocumentRequestOperationWithRequest:request
success:^(NSURLRequest *request, NSHTTPURLResponse *response, DDXMLDocument *XMLDocument)
{
}failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *HTTPError, DDXMLDocument *XMLDocument)
{
localerror = [NSError errorWithDomain:domain code:-101 userInfo:[self generateErrorDictionary:@"HTTPError"]];
success = NO;
}];
[operation start];
NSLog(@"test %@", [localerror domain]);
return success;
}
If I try to log the domain inside the failure block I get the right one. But outside the scope the block variable isnt modified. Ans hints on what I understood wrong are appreciated.