gpt4 book ai didi

objective-c - 转换 [NSNumber numberWithUnsignedInt :kCVPixelFormatType_32BGRA], (id)kCVPixelBufferPixelFormatTypeKey, nil]; swift

转载 作者:搜寻专家 更新时间:2023-10-31 08:14:14 31 4
gpt4 key购买 nike

这里报错。绞尽脑汁。尝试了各种组合。

Cannot find an initializer for type 'NSDictionary' that accepts an argument list of type '(object:(Int), forKey: CFString!)'

// configure the pixel format -  Obj-C
// videoOutput.videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA], (id)kCVPixelBufferPixelFormatTypeKey, nil];

// Swift
videoOutput.videoSettings = NSDictionary(object: Int(kCVPixelFormatType_32BGRA), forKey:kCVPixelBufferPixelFormatTypeKey)

最佳答案

更新:Xcode 7.0 • Swift 2.0

videoOutput.videoSettings = NSDictionary(object: Int(kCVPixelFormatType_32BGRA), forKey: kCVPixelBufferPixelFormatTypeKey as String) as [NSObject : AnyObject]

或者只是

videoOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey : Int(kCVPixelFormatType_32BGRA)]

关于objective-c - 转换 [NSNumber numberWithUnsignedInt :kCVPixelFormatType_32BGRA], (id)kCVPixelBufferPixelFormatTypeKey, nil]; swift ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29785246/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com