I am using UIImagePicker in viewController ,
and there are two types of methods in which I always receive a warning about memory, as well as the very well-known "wait_fences: did not receive an answer: 10004003"
but I cannot trace to a specific line of code that asks for a warning - it always comes right after these methods, where I cannot debug.
// in myViewController.h // the first 2 are the methods that I alloc my UIImagePicker, // here, self.photoPicker is a retained property of UIImagePicker. - (IBAction)fromAlbumButtonTapped { if (self.photoPicker == nil) { self.photoPicker = [[[UIImagePickerController alloc] init] autorelease]; self.photoPicker.delegate = self; } if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { self.photoPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [self presentModalViewController:self.photoPicker animated:YES]; return; } } - (IBAction)fromCameraButtonTapped { if (self.photoPicker == nil) { self.photoPicker = [[[UIImagePickerController alloc] init] autorelease]; self.photoPicker.delegate = self; } if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { self.photoPicker.sourceType = UIImagePickerControllerSourceTypeCamera; [self presentModalViewController:self.photoPicker animated:YES]; return; } } // and this is another part that gives me the memory warning - getting a photo. - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { self._photo = [info objectForKey:UIImagePickerControllerOriginalImage]; self.photoView.photoView.image = self._photo; [self.photoButton setImage:self._photo forState:UIControlStateNormal]; [self dismissModalViewControllerAnimated: YES]; }
I already checked my code and did not detect a potential memory leak, as far as I can tell.
I know that dealing with photography takes a bit of memory, so itβs normal to get a warning about the memory.
But sometimes there is a problem: viewController just release something important when a warning appears, for example, some button to return to the parentView controller in the navigation stack.
Therefore, I do not want to receive a warning that my buttons or something else important will be released too soon.
Is there any way to fix this?
source share