Reputation: 908
When I'm trying to create an array as a CFDictionary, I'm getting an error (shown bellow).
This is the code:
let attrs = [kCVPixelBufferCGImageCompatibilityKey:kCFBooleanTrue, kCVPixelBufferCGBitmapContextCompatibilityKey:kCFBooleanTrue] as CFDictionary
But the weird thing is that I'm using the same line of code in another project, without receiving any errors. What does the error mean?
Error: Contextual type 'CFDictionary' cannot be used with dictionary literal
Upvotes: 1
Views: 857
Reputation: 8351
You can use below code to convert the dictionary to CFDictionary
as mention below:
let attrs = [kCVPixelBufferCGImageCompatibilityKey as String :kCFBooleanTrue,
kCVPixelBufferCGBitmapContextCompatibilityKey as String:kCFBooleanTrue] as
CFDictionary
Hope This will helps
Upvotes: 4