Goal C | Property modifications itself


I’ve code:

-(NSString*)callApiLogin:(NSString*)electronic mail
                   :(NSString*)password {
    //Name api, I eliminated it right here

    [urlRequest setHTTPMethod:@"POST"];
    [urlRequest setHTTPBody:postData];

    NSURLSessionDataTask *dataTask = [defaultSession dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        @try {
            NSString* dataToJson = [[NSString alloc] initWithData:information encoding:NSUTF8StringEncoding];
            __block BOOL ifJsonSuccessedA = [self validateApiLogin:dataToJson];
            if (ifJsonSuccessedA) {
                self.ifSuccessedLogin = @"YES"; //I ponder, why at this case, ifsuccessedlogin equals YES...
            } else {
                self.ifSuccessedLogin = @"NO";
        } @catch (NSException *exception) {
        } @lastly {
    [dataTask resume];

    return [self ifSuccessedLogin]; //...however right here it is nil

The issue is described in feedback. I ponder, why contained in the perform, self.ifSuccessedLogin equals to YES, however the perform returns nil.


Leave a Reply

Your email address will not be published. Required fields are marked *