I have a problem like in this question: Why AVSampleBufferDisplayLayer stops showing CMSampleBuffers taken from AVCaptureVideoDataOutput's delegate?
And tried advice from this question.
But when I pasted this code:
let attachments: CFArray = CMSampleBufferGetSampleAttachmentsArray(sampleBuffer, true)!;
print(CFArrayGetCount(attachments)) // printing 1
let dict = CFArrayGetValueAtIndex(attachments, 0) as! CFMutableDictionary;
CFDictionarySetValue(dict,
unsafeBitCast(kCMSampleAttachmentKey_DisplayImmediately, to: UnsafeRawPointer.self),
unsafeBitCast(kCFBooleanTrue, to: UnsafeRawPointer.self));
App crashes while casting to CFMutableDictionary.
What am I doing wrong?