objective c - Changing View Controllers - SIGABRT -


i trying move 1 view controller when button pressed, giving me "sigabrt" error.

this code:

-(ibaction)buttonpressed:(id)sender{       statsviewcontroller *mystats = [self.storyboard instantiateviewcontrollerwithidentifier:@"statsviewcontroller"];      [self presentviewcontroller:mystats animated:yes completion:nil]; } 

the reason doing way because need pass data forward 1 view controller next.

i checked storyboard there no connections between 2 view controllers (just above code).

however, when remove above code , connect 2 view controller using "control drag" method on storyboard, works. no error..

make sure storyboard instance not nil , and storyboard id set properly

-(ibaction)buttonpressed:(id)sender{  uistoryboard *storyboard = [uistoryboard storyboardwithname:@"mainstoryboard" bundle: nil];  statsviewcontroller *lvc = [storyboard instantiateviewcontrollerwithidentifier:@"statsviewcontroller"]; [self.navigationcontroller pushviewcontroller:lvc animated:yes];  } 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -