Taking a photo with UIImagePickerController resets idleTimerEnabled to YES, regardless of previous value

Originator:haugli
Number:rdar://29311422 Date Originated:11/17/16
Status:Open Resolved:
Product:iOS SDK Product Version:10.1.1
Classification:Serious Bug Reproducible:Always
 
Summary:
When UIImagePickerController is used to take a photo using the camera, it resets [UIApplication idleTimerEnabled] to YES, even if the app had set it to NO before.

This causes the screen to auto-lock when that behavior is not what the developer intended. At best, this is annoying to the user; at worst, it's a serious safety hazard (e.g. for navigation apps).

Steps to Reproduce:
1. Launch attached sample project.
2. Tap "Take Photo" and take a photo.

Expected Results:
The label shows "Idle timer disabled", since that is what the app had set it to.

Actual Results:
The label shows "Idle timer enabled", which is not what the app had set it to.

Version:
iOS 9.3.5, iOS 10.1.1

Notes:
Stack trace where it's reset:
#7	0x000000018a8490bc in -[CMKCaptureController _resetIdleTimer] ()
#8	0x000000018a844aa8 in -[CMKCaptureController stopPreview] ()
#9	0x000000018a7f987c in -[CMKCameraView viewWillBeRemoved] ()
#10	0x000000018a834954 in -[CMKCameraViewController viewWillDisappear:] ()
#11	0x000000018c4f488c in -[PLUICameraViewController viewWillDisappear:] ()
#12	0x0000000186801434 in -[UIViewController _setViewAppearState:isAnimating:] ()
#13	0x0000000186879024 in -[UIViewController __viewWillDisappear:] ()
#14	0x00000001868c5100 in -[UINavigationController viewWillDisappear:] ()
#15	0x0000000186a68330 in -[UIImagePickerController viewWillDisappear:] ()
#16	0x0000000186801434 in -[UIViewController _setViewAppearState:isAnimating:] ()
#17	0x0000000186879024 in -[UIViewController __viewWillDisappear:] ()
#18	0x0000000186b4827c in __56-[UIPresentationController runTransitionForCurrentState]_block_invoke ()
#19	0x0000000186a9b0c8 in _runAfterCACommitDeferredBlocks ()


Configuration:
iPhone 6

Attachments:
'ImagePickerSample.zip' was successfully uploaded.

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!