ca-archived / iOS-NBUImagePicker

Modular image picker with Simulator-compatible AVFondation camera, assets library, filters and more.
http://cyberagent.github.io/iOS-NBUImagePicker
Apache License 2.0
193 stars 48 forks source link

Performing segue causes error of taking photo #4

Closed jennik closed 10 years ago

jennik commented 10 years ago

Hi! I'm trying to take photo using NBUCameraView and then push view in UINavigationController. But when i set currentFlashMode in AVCaptureFlashModeOn and take picture by following code:

- (IBAction)take:(id)sender {
    [self.cameraView takePicture:self];
    [self performSegueWithIdentifier:@"makePhotorem" sender:self];

I receive error:

Error: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x145e8b60 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x145de7a0 "The operation couldn’t be completed. (OSStatus error -12671.)", NSLocalizedFailureReason=An unknown error occurred (-12671)}

It's surprising that this error appear only when currentFlashMode set in AVCaptureFlashModeOn else it's ok. I will be grateful for any help.

rivera-ernesto commented 10 years ago

Sounds very strange indeed. I'll try to reproduce it.

rivera-ernesto commented 10 years ago

I couldn't reproduce it. Could you share a simple code demo of the problem?

Also I would push the segue right away, but do it in the captureResultBlock instead to give time to AVFoundation to capture and process the image (and also clean up the flash state that seems to be the problem).

jennik commented 10 years ago

Hello! Here is Simple project which shows the issue https://github.com/jennik/SimpleDemo. It should work (i tested it on iphone 4, 5 and 5s and gave similar result everywhere).

I've tried to push segue in the captureResultBlock but it took too much time and looked ugly. Is there any way to take photo without waiting?

rivera-ernesto commented 10 years ago

Well taking the photo takes time, but because it uses blocks usually you don't need to wait.

rivera-ernesto commented 10 years ago

Ok, fixed in https://github.com/CyberAgent/iOS-NBUImagePicker/commit/1eca64a0e93b8d7adb8c2125d482f3f8bab08e2f.

Please test with pod 'NBUImagePicker', :head.

Thank you!