esperado “:” antes do token “]” + confuso por erros anteriores, resgatando
-
26-09-2019 - |
Pergunta
Ok, então estou perdendo o juízo aqui.Eu tentei todas as coisas imagináveis para me livrar desses erros
aqui está meu código:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
/*
//<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
*/
NSInteger row = [indexPath.row];
if (self.nameExcerptPage == nil) {
NameOTWexcerpt *nameExcerptPageDetail = [[nameExcerptPage alloc] initWithNibName:@"NameOTWexcerpt" bundle:nil];
self.nameExcerptPage = nameExcerptPageDetail;
[nameExcerptPageDetail release];
nameExcerptPage.title = [NSString stringWithFormat:@"%&", [TheBookNavTabs objectAtIndex:row]];
Rothfuss_ReaderAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.SecondTableViewController pushViewController:TheBookNavTabs animated:YES];
}
}
e o erro aparece onde diz "NSInteger row = [indexPath.row];
por favor ajude!obrigado!
Solução
NSInteger row = [indexPath.row];
Notação de ponto ou [], mas não ambos!
Thyrgle pegou primeiro...
O "%&
"O especificador de formato usado em stringWithFormat me deixou um pouco confuso.Isso deveria ser %@
?É %&
um especificador de formato real?O que isso faz?O Google não faz nada...
Outras dicas
Ok, sim, mudei para [indexPath row] e funcionou.
Não tenho certeza sobre%&, peguei em um tutorial e funciona.Isso é tudo que eu sei
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow