none
WP8 使用PhotoCaptureDevice类打开拍照预览流抛出异常 RRS feed

  • 问题

  • Unable to acquire the camera. You can only use this class while in the foreground.

    初始化拍照信息时抛出异常

    “System.InvalidOperationException”类型的第一次机会异常在 mscorlib.ni.dll 中发生
    WinRT 信息:Unable to acquire the camera. You can only use this class while in the foreground.
    System.InvalidOperationException: Operation is not valid due to the current state of the object.
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

    在首页点击拍照,进入拍照页面,初始化拍照信息,在

     var captureDevice = await PhotoCaptureDevice.OpenAsync(sensorLocation, captureResolution); 过程中,立即按回退键回到首页,然后又点击拍照进入拍照页面,重复几次就抛出这个异常了。


    2013年8月15日 16:22

答案

全部回复