小编ces*_*ina的帖子

内存警告UIImagepickerController IOS 7

任何人都可以帮我解决这个问题我对目标c和iOS有点新意.我一直在努力,但我无法弄清楚如何解决问题,我的应用程序非常简单它只启动相机拍照并通过电子邮件发送到我们的服务器.这段代码在iOS6中运行得很好.

当我拍照时,我的内存是每次屏幕捕获的堆增长,我得到"接收内存警告",最后 - 由于内存压力终止. -

-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{

[self.popoverController2 dismissPopoverAnimated:true];
NSString *mediaType = [info
                       objectForKey:UIImagePickerControllerMediaType];

if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
    _image = [info
                      objectForKey:UIImagePickerControllerOriginalImage];

   _image = [self fixrotation:_image]; //<----- increased memory when UIImageWriteToSavedPhotosAlbum is uncommented IF is comment it doesn't increased memory but after some pictures I start to get "Received Memory Warning" message until the app Crash.

    if (_newMedia){
       UIImageWriteToSavedPhotosAlbum(_image,
                                       self,@selector(image:finishedSavingWithError:contextInfo:),
                                       nil);
    [self dismissViewControllerAnimated:NO completion:nil];
    [self performSegueWithIdentifier:@"SeleccionadoCameraR" sender:self];


    }else{
        [self performSegueWithIdentifier:@"SeleccionadoCameraR" sender:self];

    }

}

}

- (UIImage …
Run Code Online (Sandbox Code Playgroud)

memory-management uiimagepickercontroller didreceivememorywarning ios ios7

10
推荐指数
1
解决办法
9209
查看次数