저는 방금 Objective C/Cocoa를 배우기 시작했고 메모리 관리가 얼마나 중요한지 알고 있습니다. 나는이 오류에 대해 생각하고 있습니다.프로그램 수신 신호 : EXC_BAD_ACCESS. 이것으로 무엇을 할 것인가?
두 개의 UITextView, 하나의 Button, 하나의 UILabel이있는 매우 간단한 화면이 있습니다.
@interface PontaiViewController : UIViewController {
UITextField *loginField;
UITextField *passwordField;
UILabel *userID;
}
@property (nonatomic, retain) IBOutlet UITextField *loginField;
@property (nonatomic, retain) IBOutlet UITextField *passwordField;
@property (nonatomic, retain) IBOutlet UILabel *userID;
- (IBAction) btnLoginClicked:(id) sender;
구현이 있습니다 :
내 헤더 파일이
@implementation PontaiViewController
@synthesize loginField;
@synthesize passwordField;
@synthesize userID;
-(IBAction) btnLoginClicked:(id)sender {
NSString *string1 = @"username=";
NSString *string2 = [string1 stringByAppendingString:(loginField.text)];
NSString *string3 = [string2 stringByAppendingString:(@"&password=")];
NSString *post = [string3 stringByAppendingString:(passwordField.text)];
NSLog(@"The post is %@", post);
userID.text=loginField.text;
[string1 release];
[string2 release];
[string3 release];
[post release];
}
나는이 데모를 실행하면 그것은
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
self.loginField=nil;
self.passwordField=nil;
self.userID=nil;
}
- (void) dealloc {
[super dealloc];
[loginField release];
[passwordField release];
[userID release];
}
으로 완료하고, 쓴다. TextView에서 __LW_AT__이 오류가 발생합니다.
무엇이 될 수 있습니까?
감사합니다, viewDidUnload
에서 펠리페
정확히 어디에서 오류가 발생합니까? 'userID.text = loginField.text; '에? 그렇다면 Interface Builder에서'userID' 필드를 연결했는지 확인하십시오? –