[英]Swift 2: Type of expression is ambiguous without more context, for a dictionary
Why is the compiler throwing an error for the following code that attempts to create a dictionary? 为何编译器为以下尝试创建字典的代码引发错误? How would you fix this code? 您将如何解决此代码?
let options = [
kCVPixelBufferCGImageCompatibilityKey: true,
kCVPixelBufferCGBitmapContextCompatibilityKey: true]
I've looked through all of the other related questions with this same error and have not been able to find a solution. 我已经浏览了所有其他相关问题,但都遇到了同样的错误,但未能找到解决方案。
How about 怎么样
let options : [NSObject : AnyObject] = [
kCVPixelBufferCGImageCompatibilityKey: true,
kCVPixelBufferCGBitmapContextCompatibilityKey: true]
[NSObject : AnyObject]
is the equivalent to NSDictionary
in Objective-C. [NSObject : AnyObject]
等同于Objective-C中的NSDictionary
。 The library you're using requires it to be of this type. 您使用的库要求该库属于这种类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.