作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
这里报错。绞尽脑汁。尝试了各种组合。
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/
这里报错。绞尽脑汁。尝试了各种组合。 Cannot find an initializer for type 'NSDictionary' that accepts an argument list
我是一名优秀的程序员,十分优秀!