UIImagePickerController Showing Black Preview Screen

后端 未结 8 2263
醉梦人生
醉梦人生 2021-02-08 12:03

I am having a problem when calling the UIImagePickerController to use the camera. Sometimes, but more often than none, the preview screen shows to be black (as the camera itsel

8条回答
  •  情歌与酒
    2021-02-08 12:14

    This can happen when there is animation not started on the main thread going on in parallel to kicking off the imagePickerController

    If this is what you are running into you will likely see

    : CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces.

    On your console log

    I ran into it first by kicking off an activity indicator from a different thread (bug in its own right I know). But more insidiously this hit me due to loading a nib file in a background thread (which calls [CATransaction setDisableActions:] ... who knew)

    Turning on CA_DEBUG_TRANSACTIONS in your scheme and then running in your simulator while tailing the system log (tail -f /var/log/system.log) is really the best way to find out the specific culprit.

提交回复
热议问题