2011-10-14 23 views
0
-(IBAction)enterVeryBasics:(id)sender { 
    VeryBasics *enterIntro = [[VeryBasics alloc]initWithNibName:Nil bundle:Nil]; 
    [self presentModalViewController:enterIntro animated:YES]; 
    [enterIntro release]; 
} 

我這裏有這樣的代碼,並在[self presentModalViewController:enterIntro animated:YES];它給了我一個SIGABRTSIGABRT切換時的觀點目標C

我在同一個.m文件的多個其他操作,但它們並不具有相同問題。

+1

你的意思是通過'nil'作爲筆尖名稱嗎?或者在你的代碼中包含特定的文件名? –

+0

如果包含錯誤,它會有所幫助,SIGABRT通常包含有關導致問題的信息。 – DBD

+0

'[enterIntro release];'在那裏還爲時過早。一段時間後,您必須執行'dismissModalViewController',而不是釋放它。 –

回答

1

看UIViewController類引用實例方法簽名:

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated 

是您VeryBasics是的UIViewController子類?它看起來不像你的代碼。

+0

init方法肯定看起來像一個'UIViewController' ... – JustSid

+0

@JustSid你是對的...我會更新我的答案。 – ARC

0
VeryBasics *enterIntro = [[VeryBasics alloc]init]; 
self presentModalViewController:enterIntro animated:YES]; 
[enterIntro release]; 

如果你沒有nib,所以不需要initWithNibName就使用這個。