未找到 UIApplicationLaunchOptionsKey
UIApplicationLaunchOptionsKey not found
UIApplicationDelegate 方法 - application(_:didFinishLaunchingWithOptions:) 显示 Swift 4.2 (Xcode 10) 的错误。
UIApplicationLaunchOptionsKey not found
Swift 4.2 中 UIApplicationLaunchOptionsKey
的替换是什么?
Xcode 会修复它,但 UIApplicationLaunchOptionsKey
被嵌套类型 UIApplication.LaunchOptionsKey
.
取代
应该是UIApplication.LaunchOptionsKey
,请找下面的apple documentation
'UIApplicationLaunchOptionsKey' has been renamed to 'UIApplication.LaunchOptionsKey'. Replace 'UIApplicationLaunchOptionsKey' with 'UIApplication.LaunchOptionsKey'.
点击错误提示,将显示解决方案:
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
}
我已经尝试了下面的代码片段并为我工作。
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication: Any]? = nil) -> Bool {
}
只需在 launchOptions 中提供 UIApplication。
希望它也对你有用。 :)
UIApplicationDelegate 方法 - application(_:didFinishLaunchingWithOptions:) 显示 Swift 4.2 (Xcode 10) 的错误。
UIApplicationLaunchOptionsKey not found
Swift 4.2 中 UIApplicationLaunchOptionsKey
的替换是什么?
Xcode 会修复它,但 UIApplicationLaunchOptionsKey
被嵌套类型 UIApplication.LaunchOptionsKey
.
应该是UIApplication.LaunchOptionsKey
,请找下面的apple documentation
'UIApplicationLaunchOptionsKey' has been renamed to 'UIApplication.LaunchOptionsKey'. Replace 'UIApplicationLaunchOptionsKey' with 'UIApplication.LaunchOptionsKey'.
点击错误提示,将显示解决方案:
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
}
我已经尝试了下面的代码片段并为我工作。
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication: Any]? = nil) -> Bool {
}
只需在 launchOptions 中提供 UIApplication。 希望它也对你有用。 :)