iOS 12 SDK 更新
在 iOS 12 SDK(Xcode 10 附带)中,UIApplicationLaunchOptionsKey
现在已重命名为嵌套类型UIApplication.LaunchOptionsKey
,因此您需要:
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// ...
}
iOS 10 和 11 SDK(Xcode 8 和 9)
这个警告是因为委托方法的didFinishLaunchingWithOptions:
参数application(_:didFinishLaunchingWithOptions:)
现在被桥接到 Swift 作为 a [UIApplicationLaunchOptionsKey: Any]?
,而不是[NSObject : AnyObject]?
.
Therefore you'll need to update your implementation to reflect this change:
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
// ...
}
Note that neither of Xcode's suggested fixes will actually fix the problem, they'll only conceal your implementation of application(_:didFinishLaunchingWithOptions:)
from Objective-C – meaning that it'll never actually get called.