2012-03-12 12 views
1

私はこの初めてのアプリケーションとしてこのアプリケーションに取り組んできました。タブ付きのアプリですが、何らかの理由で他のタブをタップするとクラッシュします。スレッド1:プログラム受信信号 "SIGABRT" iOS

ログにクラッシュ例外または理由がなく、表示されるのはスレッド1:プログラム受信信号 "SIGARBT"です。

私はInterface Builderを使用し始めましたが、疲れてファイルを削除してloadViewを使用しましたが、プロジェクトをクリーニングしてもエラーは発生します。 FirstViewControllerはまったく同じコードを使用し、正常に動作します。

#import "SecondViewController.h" 

@implementation SecondViewController 

-(void)loadView 
{ 
    [self setView:[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]]; 
    [[self view] setBackgroundColor:[UIColor blackColor]]; 

textField = [UITextField alloc]; 
[textField setEnablesReturnKeyAutomatically:YES]; 
[textField setKeyboardType:UIKeyboardTypeDefault]; 
[textField setSpellCheckingType:UITextSpellCheckingTypeNo]; 
[textField setFrame:CGRectMake(20, 30, 280, 40)]; 
[[self view] addSubview:textField]; 

setContextButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
[setContextButton setTitle:@"Set" forState:UIControlStateNormal]; 
[setContextButton setFrame:CGRectMake(80, 30, 60, 40)]; 
[[self view] addSubview:setContextButton]; 
} 
+0

アボートが発生したときのスタックの外観は何ですか? – user1118321

+0

argv(char)47 '/' – user1222053

+0

私はその意味を理解していません。私はあなたにすべての関数呼び出しが中断まで表示されているスタックトレース全体をポストするようにお願いしています。 – user1118321

答えて

0

私はラインtextField = [UITextField alloc];が不完全だと思います。 alloc'd textFieldののinitメソッドの1つを呼び出す必要があります。

あなたSecondViewController.hがすでに定義されてUITextField *textFieldを持っていると仮定すると、試してみてください。

textField = [[UITextField alloc] initWithFrame:CGRectMake(20, 30, 280, 40)]; 

あなたは、TextFieldのに応じて、他の問題につながる可能性がありを(定義されていない場合はどのようなあなたのコードの残りの部分見えるように)、try:

UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(20, 30, 280, 40)]; 
関連する問題