UIApplicationDelegate 方法 - application(_:didFinishLaunchingWithOptions:)显示 Swift 4.2 (Xcode 10) 的错误。
未找到 UIApplicationLaunchOptionsKey
UIApplicationLaunchOptionsKey
Swift 4.2中的替换是什么?
UIApplicationDelegate 方法 - application(_:didFinishLaunchingWithOptions:)显示 Swift 4.2 (Xcode 10) 的错误。
未找到 UIApplicationLaunchOptionsKey
UIApplicationLaunchOptionsKey
Swift 4.2中的替换是什么?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
}
Xcode 会修复它,但UIApplicationLaunchOptionsKey
被嵌套类型替换UIApplication.LaunchOptionsKey
。
应该是UIApplication.LaunchOptionsKey
,请查找以下苹果文档
我已经尝试了下面的代码片段并为我工作。
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication: Any]? = nil) -> Bool {
}
只需在 launchOptions 中提供 UIApplication。希望它也对你有用。:)