내가 잘못하고 있는지, 나는 간단한 사용자 지정 카메라를 만들고 싶습니다. AVCapturePhotoOutput을 AVCaptureSession에 연결하고, 최소 설정으로 AVCapturePhotoSettings를 만들어 그림 작업을 수행합니다. 아래 코드를 참조하십시오.AVCapturePhotoSettings 허용하지 않는 NSDictionary 요소
예외가 발생합니다. kCVPixelBufferPixelFormatTypeKey가 정의되지 않지만 실제로 통과하는 NSDictionary에 있습니다. 내가 여기에 몇 가지 빛을 필요
, 감사public void TakePicture()
{
var output = new AVCapturePhotoOutput();
_captureSession.AddOutput(output);
var settings = AVCapturePhotoSettings.Create();
var previewPixelType = settings.AvailablePreviewPhotoPixelFormatTypes.First();
var keys = new[]
{
new NSString("kCVPixelBufferPixelFormatTypeKey"),
new NSString("kCVPixelBufferWidthKey"),
new NSString("kCVPixelBufferHeightKey"),
};
var objects = new NSObject[]
{
// don't have to be strings... can be any NSObject.
previewPixelType,
new NSString("160"),
new NSString("160")
};
var dicionary = new NSDictionary<NSString, NSObject>(keys, objects);
settings.PreviewPhotoFormat = dicionary;
output.CapturePhoto(settings,this);
}
다음과 같이 전달하여 문제를 해결했습니다. settings.PreviewPhotoFormat = new NSDictionary (CVPixelBuffer.PixelFormatTypeKey, settings.AvailablePreviewPhotoPixelFormatTypes [0]); 왜 첫 번째 시도가 효과가 없었는지 확실하지 않습니다. –
RollRoll