objective c - Multiview app memory leak warning. -
 I created a multiviapp app based on this. This is my code  appdelegate.h     and ".m"    and dealloc    Since I want to switch to another view, I use the following code    Just like the tutorial. But when I analyzed the test, there is possible memory leak in the code above the X code warning. So I added (in the case above)     The rule for memory ownership is:    If your method name starts with 'alloc', 'init', 'copy', 'mutablecopy' or 'new', they are responsible for issuing it, either release   yes, you have a memory leak, so you should issue 'Disclaimer View 2' with 'codeay' [Rejection Release 2]     However, the reason F you crash that caused elsewhere bug in your code.    If you are going to pass it in your representative,  your representative should retain it  - otherwise, try to use it at some point in the representative future, but It will be canceled.    
 @class Disclaimerviewcontroller; @ Interface GAINSAppDelegate: NSObject & lt; UIApplicationDelegate & gt; {Disclaimer Controller * First view; } @ Property (Nonomatic, Retaining) IBOutlet UIWindow * Window; @property (nonatomic, retained) Disclaimerviewcontroller * firstview; - (zero) switchviewview: (UIView *) View 1 overview: (UIView *) view2; I have the following in @end    
 - (BOOL) Application: (UIApplication *) Application FinishLaunchingWithOptions: (NSDictionary * ) Launchoptions {// Override Point after application launch [auto Windows and knowledgeable]; Disclaimerviewcontroller * aview = [[Disclaimerviewcontroller alloc] initWithNibName: @ "Disclaimerviewcontroller" bundle: zero]; Self.firstview = aview; [_window addSubview: aview.view]; [Overview]; Yes come back } - (zero) switchviewview: (UIView *) View 1 overview: (UIView *) View 2 [[UivView startup permissions: @ "animation" reference: zero]; [UIView Set Animation Duration: 0.50]; [UIView Set Animation Transition: UIViewAnimationTransitionFlipFromLeft forView: self.window cache: yes]; [View1 removeFromSuperview]; [_window addSubview: view2]; [UIView commitAnimations]; }    
 - (zero) Delok {[first view release]; [_Windows release]; [Super DeLoc]; }    
 - (IBAction) switchtodisclaimer2: (id) sender {GAINSAppDelegate * delegate = (GAINSAppDelegate *) [[UIApplication shared application]]]; Disclaimerviewcontrller2 * Disclaimer = 2 [[Disclaimerviewcontrller2 alloc] initWithNibName: @ "Disclaimerviewcontrller2" bundle: zero]; [Representative switch view: self.view Overview: Disallow. 2. View]; }    [disclaimerview2 release];  And when I run the program, I get the  EX_BAD_ACCES  error since I thought it was with the name, it was an autorelage? now I'm confused. The tutorial does not address all this on    
 With  or  autorelease      
 
  
Comments
Post a Comment