ios - Crash on master/detail app, when changing category, after releasing Var -
i'm struggling figure out why app crashing when release synthesized properties. app launches, , when tap on row, takes me detailviewcontroller, when go , tap row again app crashes exc_bad_access.
detailviewcontroller.h:
#import <uikit/uikit.h> @interface detailviewcontroller : uiviewcontroller { iboutlet uilabel *clipboardlabel; } @property (nonatomic, retain) iboutlet uilabel *clipboardlabel; @end
detailviewcontroller.m
#import "detailviewcontroller.h" @implementation detailviewcontroller @synthesize clipboardlabel; - (void)viewdidload { // additional setup after loading view nib. clipboardlabel.text = @"tap image copy"; [super viewdidload]; } - (void)dealloc { [clipboardlabel dealloc]; [super dealloc]; } @end
call release
instead of dealloc
on clipboardlabel in dealloc
method.
that should :
- (void)dealloc { [clipboardlabel release]; [super dealloc]; }
a general rule : 1 should never call dealloc
on object.
Comments
Post a Comment