Reputation: 2848
I'm doing an application which allows user to take a picture from camera or select picture from library. I'm using the code
- (BOOL)startCameraPickerFromViewController:(UIViewController*)controller usingDelegate:(id<UIImagePickerControllerDelegate>)delegateObject
{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
UIImagePickerController *picker = [[[UIImagePickerController alloc] init]autorelease];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.allowsImageEditing = YES;
picker.delegate = self;
[controller presentModalViewController:picker animated:YES];
}
return YES;
}
I'm getting memory leak when I'm running this application. I'm running this application on 3.0.
Guys Please help me.
Upvotes: 0
Views: 645
Reputation:
After [controller presentModalViewController:picker animated:YES];
do [picker release];
and get rid of the autorelease when you init the UIImagePickerController. That may work?
Upvotes: 1