NSArrayM insertObject: atIndex:]: o objeto não pode ser nulo
Depois de muita pesquisa, e tenta com algumas soluções em stackoverflow, eu não encontrei nenhuma resposta que pudesse resolver o meu erro: Eu tenho um UIViewcontroller, cujo nome é WorldViewController. Neste UIViewcontroller, eu tive init algumas UIViews. Eu quero modificar algumas variáveis que dependem do WorldViewController de algumas UIViews. E agora que eu coloquei essas linhas:
WorldViewController * World = [[WorldViewController alloc] init];
isso me dá:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
Então, como consertar isso? Poderia acontecer pelo fato de o WorldViewController estar rodando? E então, como consertar isso?
Edit: init método do meu viewcontroller
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
World1 = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 480.0)];
[World1 setBackgroundColor:[UIColor blackColor]];
[self.view addSubview:World1];
[World1 release];
[self.view addSubview:ViewPig];
[self.view addSubview:level1view];
[self.view addSubview:level2view];
[self.view addSubview:LoadView];
[LoadView AnimPigLoadingWith:PigChargement];
[LoadView AppearLabelLoading];
[self.view addSubview:FondPauseGrise];
[self.view addSubview:FondPause];
[self.view addSubview:BoutonResume];
[self.view addSubview:BoutonHome];
[self performSelector:@selector(Chargement) withObject:nil afterDelay:0.5];
[self performSelector:@selector(ViewAppears) withObject:nil afterDelay:5.5+2.5];
[self performSelector:@selector(LabelPrevientDepartWithImage:) withObject:Trois afterDelay:9];
[self performSelector:@selector(LabelPrevientDepartWithImage:) withObject:Deux afterDelay:10];
[self performSelector:@selector(LabelPrevientDepartWithImage:) withObject:Un afterDelay:11];
[self performSelector:@selector(LabelPrevientDepartWithImage:) withObject:Go afterDelay:12];
[self performSelector:@selector(Lancement) withObject:nil afterDelay:(3)];
[self performSelector:@selector(GestionMaps) withObject:nil afterDelay:(11+2)];
}
return self;
}
Obrigado !