iOS 4.1用のXcode 4.3.2でIphoneアプリケーションを開発しています
IB から UIView に UIButton を追加し、IBAction に接続しました。しかし、ボタンをタッチすると、EXC_BAD_ACCESSエラーが発生しました。
プロジェクトの作成時に ARC を有効にしました。
このエラーとグーグルの後、メモリ管理が悪いとこのエラーが発生することがわかりました。しかし、この問題の原因を特定できませんでした。どうすれば問題を見つけることができますか?
.h ファイルに含まれるもの
-(IBAction)openTwitterSignInViewController:(id)sender;
.m ファイルに含まれるもの
- (void)openTwitterSignInViewController:(id)sender{
UIViewController *secondViewController = [[TwitterSignInViewController alloc] initWithNibName:@"TwitterSignInViewController" bundle:nil];
[self.navigationController pushViewController:secondViewController animated:YES];
}
またUIButton
、openTwitterSignInViewController
IB経由で接続されています。
コンソール出力がありません。理由はわかりません。だから私はスクリーンショットを追加しています。
LoginViewController.m
#import "LoginViewController.h"
#import "Helper.h"
#import "TwitterSignInViewController.h"
@interface LoginViewController ()
@end
@implementation LoginViewController
@synthesize topBarText, userNameText, passwordText, passwordReminderButton, loginButton;
@synthesize signInTwitterButton, registerButton;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 20)];
userNameText.leftView = paddingView;
userNameText.leftViewMode = UITextFieldViewModeAlways;
passwordText.leftView = [NSKeyedUnarchiver unarchiveObjectWithData:
[NSKeyedArchiver archivedDataWithRootObject: paddingView]];
passwordText.leftViewMode = UITextFieldViewModeAlways;
topBarText.font = [UIFont fontWithName:@"Neo Sans Pro" size:14 ];
userNameText.font = [UIFont fontWithName:@"Neo Sans Pro" size:14];
passwordText.font = [UIFont fontWithName:@"Neo Sans Pro" size:14];
passwordReminderButton.titleLabel.font = [UIFont fontWithName:@"Neo Sans Pro" size:14];
loginButton.titleLabel.font = [UIFont fontWithName:@"Neo Sans Pro" size:14];
registerButton.titleLabel.font = [UIFont fontWithName:@"Neo Sans Pro" size:14];
}
- (IBAction)openTwitterSignInViewController:(id)sender{
TwitterSignInViewController *secondViewController = [[TwitterSignInViewController alloc] initWithNibName:@"TwitterSignInViewController" bundle:nil];
[self.navigationController pushViewController:secondViewController animated:YES];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
少なくとも、Zombie Objects を有効にしてコンソール出力を取得しました。これが出力です。しかし、私はまだエラーを見つけることができませんでした
2012-08-01 21:11:30.569 adMingle[3156:f803] *** -[LoginViewController performSelector:withObject:withObject:]: message sent to deallocated instance 0x6857420