Ios UILocalNotification在字典中标记为不明确

Ios UILocalNotification在字典中标记为不明确,ios,swift,uilocalnotification,Ios,Swift,Uilocalnotification,我错过了什么 var notifications = [Int, UILocalNotification]() 为什么会出现这样的错误: "Type of expression is ambiguous without more context" 如果你想要一本字典,那么你的语法是错误的,应该是: var notifications = [Int : UILocalNotification]() 谢谢,我读到这篇文章也是因为我的做法是实例化一本NSDictionaryvar通知:Dicti

我错过了什么

var notifications = [Int, UILocalNotification]()
为什么会出现这样的错误:

"Type of expression is ambiguous without more context"

如果你想要一本字典,那么你的语法是错误的,应该是:

var notifications = [Int : UILocalNotification]()

谢谢,我读到这篇文章也是因为我的做法是实例化一本NSDictionaryvar通知:Dictionary=[:]`也有效吗?是的,这实际上是一样的,而且
var通知:[Int:UILocalNotification]=[:]
投票关闭,因为问题是一个错误的字符。对于这样的情况,真的是一个语法检查器吗?@Daij Djan这个错误是误导性的,当我读到它时,我想到了UILocalNotification的作用域错误