Can not assign values to self properties from within a block

I have a viewcontroller class and another class of NSObject. I call from the viewcontroller class the following method

-(void)generateIDforImage{
    @weakify(self)
    [[[ApiServicesProvider shared] userService] getCreatorsContentID:^(NSDictionary * _Nullable result, NSError * _Nullable error) {
        @strongify(self)
        if(nil==error){
            NSString* ccID = result.creatorsContentId;
            self.creatorsContentID = ccID;
            NSLog(@"creatorsContentID %@",self.creatorsContentID);
         
            [self getImageUploadURL:ccID withNumberOfAttempts:10];
        }
        else{
            self.isUploading = NO;
        }
    }];
}

at this line

NSLog(@"creatorsContentID %@",self.creatorsContentID);

creatorsContentID is null although at this line

self.creatorsContentID = ccID;

ccID is not null so self.creatorsContentID should not be null.

Moreover at this line

[self getImageUploadURL:ccID withNumberOfAttempts:10];

is never get called.

What am i missing?

This topic was automatically closed after 166 days. New replies are no longer allowed.