After a lot of search, and tries with some solutions on stackoverflow, i didn't find any answer which could solve my error :
I have a UIViewcontroller, who's name is WorldViewController. In this UIViewcontroller, i had init some UIViews. I want to modificate some variables which depends of WorldViewController from some UIViews. And now that i put those lines :
WorldViewController * World = [[WorldViewController alloc] init];
it gives me :
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
So, how to fix it ? Could it comes from the fact that WorldViewController is running ? And so, how to fix it ?
Edit : init method of my 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;
}
Thanks !
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…