正如我的问题所述,我在尝试编写这段代码时不断收到错误“extra argument 'forKey' in call”。谁能解释一下为什么?
var rgbOutputSettings:NSDictionary = NSDictionary(object: NSNumber(int: kCMPixelFormat_32BGRA), forKey: kCVPixelBufferPixelFormatTypeKey)
最佳答案
kCVPixelBufferPixelFormatTypeKey
是一个 CFStringRef
而不是 NSString
。您需要将其转换为 NSString
,如下所示:
var formatKey = kCVPixelBufferPixelFormatTypeKey as NSString
var rgbOutputSettings:NSDictionary = NSDictionary(object: NSNumber(int: kCMPixelFormat_32BGRA), forKey: formatKey)
关于ios - 调用中的 NSDictionary 额外参数 "forKey",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29339192/