开发者

presentModalViewController memory leak or EXC_BAD_ACCESS

-(void) addBookmarkTapped:(id)sender {
    BookmarkAddViewController *bookmarkAddViewController = 
    [[BookmarkAddViewController alloc] initWithName:currTitle link:self.addressBar.text];
    [self presentModalViewController:bookmarkAddViewController animated:YES];
    [bookmarkAddViewController release];
}                 

code above cause 'EXC_BAD_ACCESS' when back to the mai开发者_开发百科n controller. Same error if I make bookmarkAddViewController 'autorelease'.

It will not crash if I remove the release, but it will cause memory leak? [bookmarkAddViewController release];

I see many examples doing the same way, why it doesn't work in my case?


It might have to do with your init method in bookmarkAddViewController.(Please post.) Make sure you dismiss the controller properly with [self dismissModalViewControllerAnimated:YES];.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜