UIImagePickerController run out of memory with camera source

前端 未结 2 570
一整个雨季
一整个雨季 2021-02-03 16:39

I got a big performance issue using UIImagePickerController and saving the image on disk. I can\'t figure out what I am doing wrong. Here is my code:



        
2条回答
  •  执笔经年
    2021-02-03 16:43

    I had a similar issue. The way I got round it was to handle the image from the picker in a seperate thread. My problem was the main thread handling my app/UI was crashing out when trying to close the picker and handle the image:

    - (void)imagePickerController:(UIImagePickerController *)picker
        didFinishPickingImage:(UIImage *)image
                  editingInfo:(NSDictionary *)editingInfo
    {
        [[picker parentViewController] dismissModalViewControllerAnimated:YES];
    
        NSLog(@"picker did finish");
        [NSThread detachNewThreadSelector:@selector(useImage:) toTarget:self withObject:image];
    
    }
    

提交回复
热议问题