您可以提供任何帮助,将不胜感激。

我有具有的tableView,的DetailView,flipView,和浏览更详细查看一个应用程序。它是通过转换,直至26日元素精细运动。应用程序崩溃时,我打的按钮,导航到翻转和moreDetailView。

<强>我给出的错误消息:。[NSIndexPath row] message sent to deallocated instance

我想我可能是在提醒indexPath过很多次,但为什么做一切工作顺利,直到25元,然后停止工作?怎么了NSIndexPath得到释放?我永远不会释放它。

如果你知道,请帮助。谢谢!

Xcode的说,问题是在这里:

@implementation produceView aka *detailView*

- (IBAction)showInfo {

        FlippedProduceView *fView = [[FlippedProduceView alloc]initWithIndexPath:index];
    fView.flipDelegate = self;


    fView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:fView animated:YES];
         [fView release]; 

}


 - (IBAction) buttonPushed:(id)sender

{

    picView *pictureView = [[picView alloc]initWithIndexPath:index];


    pictureView.picDelegate = self;
    pictureView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;     

    [self presentModalViewController:pictureView animated:YES];
        [pictureView release];
}

-(id)initWithIndexPath:(NSIndexPath *)myIndexPath {   
if (self == [super init]) {
            path = myIndexPath;

    }
    return self;

}

@implementation picView aka *moreDetailView*

- (void)viewDidLoad {
    RipeGuideAppDelegate *AppDelegate = (RipeGuideAppDelegate *)[[UIApplication sharedApplication] delegate];
    self.picViewArray = AppDelegate.arrayProduceInfo;

    NSMutableDictionary *dictionary = [picViewArray objectAtIndex:path.row];
}

@implementation FlippedProduceView aka *flipView*


- (id)initWithIndexPath:(NSIndexPath *)myIndexPath {
    if (self == [super init]) {
        indexes = myIndexPath;
    }
    return self;
}

- (void)viewDidLoad {
    RipeGuideAppDelegate *AppDelegate = (RipeGuideAppDelegate *)[[UIApplication sharedApplication] delegate];
    self.flipViewArray = AppDelegate.arrayProduceInfo;

    NSMutableDictionary *dictionary = [flipViewArray objectAtIndex:indexes.row];
}
有帮助吗?

解决方案

您应该使用性质(@property (retain) NSIndexPath *path;),而不是实例变量,所以后来当你self.path = myIndexPath那么它提出了保留计数,所以当IndexPath会被自动释放它不会被释放。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top