2011-12-06 3 views
0

저는 iPhone을위한 간단한 서명 캡처 응용 프로그램을 만드는 멍청한 놈입니다.iPhone 응용 프로그램에서 좀비 객체를 식별 할 수 없습니다.

응용 프로그램은 사용자가 전달로 채워진 테이블보기로 이동하도록합니다. 그런 다음 현재 배달중인 배달을 클릭합니다.

테이블보기를로드하려고 할 때 EXC_BAD_ACCESS 오류가 발생하므로 좀비 진단기를 실행하여 문제를 찾을 수 있는지 확인하십시오. 내가 좀비 오류를 가지고 있지만, 책임 책임자 (Responsible Caller)는 내가 작성한 코드를 참조하지 않습니다.

내 앱의 기본 흐름은 지금까지 3 개의 버튼이있는보기가 있는데 그 중 하나는 테이블보기로 연결되고 사용하면 충돌이 발생합니다.

#import <UIKit/UIKit.h> 

@interface DeliveriesViewerController : UITableViewController <UITableViewDelegate> { 
    IBOutlet UITableView *myTable; 
} 

@property (nonatomic, retain) UITableView *myTable; 

@end 

구현 : 이것은

헤더로 전환된다는 배달 클래스 코드

-(IBAction) deliveriesButtonClicked:(id)sender { 
    if (self.deliveriesViewer == nil) { 
     DeliveriesViewerController *aOptionController = [[DeliveriesViewerController alloc] initWithNibName: @"DeliveriesViewerController" bundle: nil]; 
     self.deliveriesViewer = aOptionController; 
     [aOptionController release]; 
    } 

    [self.mainNavigationController.view removeFromSuperview]; 
    [self.view insertSubview:self.deliveriesViewer.view atIndex:0]; 

} 

이다

뷰 스위치 용 코드 :

#import "DeliveriesViewerController.h" 
#import "AppDelegate.h" 

@implementation DeliveriesViewerController 

@synthesize myTable; 

- (void)didReceiveMemoryWarning { 
    [super didReceiveMemoryWarning]; 
}  

- (void)viewDidUnload { 

} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 
    return appDelegate.invoices.count; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
    static NSString *MyIdentifier = @"MyIdentifier"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; 

    if (cell == nil) { 
     cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease]; 
    } 

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 
    cell.text = [appDelegate.invoices objectAtIndex:indexPath.row]; 
    return cell; 
} 

@end 

누구든지 내가이 문제를 발견 할 수 있다면 큰 도움이 될 것입니다.

+0

deliveriesViewer를 retain 속성으로 설정 했습니까? – Daniel

+0

예. 보유하도록 설정되었습니다. – AquaCash5

+0

송장 배열을 만드는 코드를 게시하십시오 –

답변

1

문제점을 파악했습니다.

문제는 내가 잘못된 데이터 소스를 갖고 테이블보기에 대한 위임자가 있다는 것입니다. 기본적으로 파일 소유자가 아니라 tableview 자체로 설정되었습니다.

내 문제의 intrest를 보여 주셔서 감사합니다.

+0

내게 무슨 일이 일어나는지는 비슷한 것입니다. 책임자를 보여주십시오. 동시에 Xcode에서 NSZombie 추적을 활성화 한 후 '[NSObject respondsToSelector :] : 메시지가 할당 해제 된 인스턴스로 전송되었습니다'라는 메시지를 표시합니다. 문제는 두 개의 객체가 슈퍼 클래스에서 객체 하나를 할당하고 해제하는 책임이 있고 다른 하나는 nib 파일에서 나온 것입니다. "내 의견이 사람들을 돕기에 충분히 유용하기를 바란다" –

관련 문제