[英]Why ambiguous reference to member 'Subscript'?
This is my Swift 3 code: 这是我的Swift 3代码:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if let userInfo : Foundation.NSDictionary = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? Foundation.NSDictionary {
self.setNavigationInfoFromPushNotification(userInfo: userInfo)
navigateFromPushNotification()
}
...
}
It results in a compile-time error that says: 它导致一个编译时错误,指出:
Ambiguous reference to member 'Subscript' 对成员“下标”的含糊不清
Please can anyone help me with this? 请任何人可以帮助我吗?
The method signature has changed. 方法签名已更改。 See How to handle launch options in Swift 3 when a notification is tapped? 请参阅在轻按通知时如何处理Swift 3中的启动选项? Getting syntax problems . 获取语法问题 。
It is now: 就是现在:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
if let userInfo = launchOptions?[.remoteNotification] as? NSDictionary {
setNavigationInfoFromPushNotification(userInfo: userInfo)
navigateFromPushNotification()
}
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.