iOS - Não foi possível definir o texto do UILabel

Ok, deixe-me explicar a situação, eu tenho dois view controller, vamos chamá-los primeiro e segundo.

FirstViewController herdar de UITableViewControllerSecondViewController herdar de UIViewController

A interface para o SecondViewController é feita com o Interface Builder e contém simplesmente um rótulo e um UIProgressView. a etiqueta e a tomada UIProgressView são conectadas ao proprietário correto dos arquivos (SecondViewController).

um pouco de código, no FirstViewController:

o método a seguir é acionado por uma notificação

- (void) addTransfer:(NSNotification *)notification{

      NSLog(@"notification received");
      NSDictionary *transferInfo = [notification userInfo];
      // I think the problem is here 
      aTransfer = [[DbTransfer alloc] initWithNibName:@"DbTransfer" bundle:nil];
      //
      aTransfer.srcPath = [transferInfo objectForKey:@"srcPath"];
      aTransfer.dstPath = [transferInfo objectForKey:@"dstPath"];
      [aTransfer startTransfer];
      [transfer addObject:aTransfer];
      [self.tableView reloadData];

}

esses são os métodos tableView dataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
   return 1;
}


- (NSInteger)tableView:(UITableView *)tableView 
                                      numberOfRowsInSection:(NSInteger)section   
{
   NSLog(@"%d numberOfRowsInSection",[transfer count]);
   return [transfer count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView 
                               cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{

static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault   
                                     reuseIdentifier:CellIdentifier] autorelease];
}

[cell.contentView addSubview:[[transfer objectAtIndex:indexPath.row] view]];
return cell;

}

este é o código do SecondViewController.h

@interface DbTransfer : UIViewController <DBRestClientDelegate> {

IBOutlet UILabel *fileNameLabel;
IBOutlet UIProgressView *transferProgress;

NSString *srcPath;
NSString *dstPath;

DBRestClient *restClient;


}

@property (nonatomic,retain) IBOutlet UILabel *fileNameLabel;
@property (nonatomic,retain) IBOutlet UIProgressView *transferProgress;
@property (nonatomic,retain) NSString *srcPath;
@property (nonatomic,retain) NSString *dstPath;

- (void) startTransfer;

@end

este é um método dentro do SecondViewcontroller.m

- (void) startTransfer{
//NSLog(@"%@\n%@",srcPath,dstPath);

if (!fileNameLabel) {
    NSLog(@"null");
}
[self.fileNameLabel setText:[srcPath lastPathComponent]];
//self.fileNameLabel.text=@"test";


NSLog(@"%@",fileNameLabel.text);


restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
restClient.delegate=self;

[restClient loadFile:srcPath intoPath:dstPath];

}

como você pode ver dentro do startTransfer, verifico se fileNameLabel é nulo e não entendo o motivo. Talvez o valor nulo esteja relacionado à alocação do iVar aTransfer. Aliás, é impossível definir o texto do rótulo.

questionAnswers(2)

yourAnswerToTheQuestion