UIImagePickerController sometimes crashes app while capturing photos

Originator:greg.cooksey
Number:rdar://19735421 Date Originated:02/05/2015
Status:Duplicate Resolved:No
Product:iOS SDK Product Version:8.2 (12D5480a)
Classification:Crash Reproducible:Sometimes
 
UPDATE: Apple closed as Duplicate of 18206279 (Open)

Summary:
My app uses UIImagePickerController to take photos and send them to our server. I am seeing occasional crashes when taking pictures with an iPhone 6+. I don't believe that these crashes are in my code; it appears that something is going wrong in UIImagePickerController when it is preparing to call its delegate's -[imagePickerController:didFinishPickingMediaWithInfo:] method.

From the Xcode console log:

2015-02-05 15:38:29.567 ACE Client[209:8380] *** Camera: Error capturing still image (Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x174466f00 {NSUnderlyingError=0x1744416e0 "The operation couldn’t be completed. (OSStatus error -16802.)", NSLocalizedFailureReason=An unknown error occurred (-16802), NSLocalizedDescription=The operation could not be completed})

Steps to Reproduce:
1. Present a UIImagePickerController with custom controls
2. Call -takePicture a number of times

Expected Results:
The UIImagePickerController's delegate's -imagePickerController:didFinishPickingMediaWithInfo: method is called for each call of -takePicture.

Actual Results:
Eventually the app threw an exception with the attached crash log and logged an error to the debug console:

2015-02-05 15:38:29.567 MyApp[209:8380] *** Camera: Error capturing still image (Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x174466f00 {NSUnderlyingError=0x1744416e0 "The operation couldn’t be completed. (OSStatus error -16802.)", NSLocalizedFailureReason=An unknown error occurred (-16802), NSLocalizedDescription=The operation could not be completed})

Version:
8.2 (12D5480a)

Configuration:
iPhone 6+ (A1524), iOS 8.2 beta 5

Exception stack trace:

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: UIImagePickerControllerOriginalImage)'

Last Exception Backtrace:
0   CoreFoundation                      0x000000018723a59c __exceptionPreprocess + 132
1   libobjc.A.dylib                     0x000000019798c0e4 objc_exception_throw + 60
2   CoreFoundation                      0x00000001871251f8 -[__NSDictionaryM setObject:forKey:] + 972
3   PhotoLibrary                        0x0000000191df5aa8 __CreateInfoForImage + 772
4   PhotoLibrary                        0x0000000191df5748 PLNotifyImagePickerOfImageAvailability + 28
5   PhotoLibrary                        0x0000000191e41a10 -[PLImagePickerCameraView cropOverlay:didFinishSaving:] + 308
6   PhotoLibrary                        0x0000000191e4200c -[PLImagePickerCameraView captureController:didCompleteResponse:forStillImageRequest:error:] + 1484
7   CameraKit                           0x000000018d68eef0 -[CAMCaptureController _completedResponse:forRequest:error:] + 232
8   CameraKit                           0x000000018d68e678 __56-[CAMCaptureController enqueueStillImageCaptureRequest:]_block_invoke_32113 + 268
9   libdispatch.dylib                   0x0000000197fd13ac _dispatch_call_block_and_release + 24
10  libdispatch.dylib                   0x0000000197fd136c _dispatch_client_callout + 16
11  libdispatch.dylib                   0x0000000197fd5980 _dispatch_main_queue_callback_4CF + 932
12  CoreFoundation                      0x00000001871f1fa4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
13  CoreFoundation                      0x00000001871f004c __CFRunLoopRun + 1492
14  CoreFoundation                      0x000000018711d0a4 CFRunLoopRunSpecific + 396
15  GraphicsServices                    0x00000001902b75a4 GSEventRunModal + 168
16  UIKit                               0x000000018ba4eaa4 UIApplicationMain + 1488
17  MyApp                          0x0000000100081ad8 main (main.m:16)
18  libdyld.dylib                       0x0000000197ffaa08 start + 4

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!