After installing Xcode 8 beta 6, I'm getting a warning saying:
Instance method 'application(_:didFinishLaunchingWithOptions:)' nearly matches optional requirement 'application(_:didFinishLaunchingWithOptions:)' of protocol 'UIApplicationDelegate'
in my App Delegate.
There are 2 suggested fixits to silence the warning:
- Mark the method as private
- Add @nonobjc to the method
Doing either silences the warning. But why does this need to be done?
or the New Syntax
you can get the latest Documentation from apple and sample link in here
iOS 12 SDK Update
In the iOS 12 SDK (that ships with Xcode 10),
UIApplicationLaunchOptionsKey
has now been renamed to the nested typeUIApplication.LaunchOptionsKey
, so you'll want:iOS 10 and 11 SDKs (Xcode 8 and 9)
This warning is due to the fact that the
didFinishLaunchingWithOptions:
parameter of theapplication(_:didFinishLaunchingWithOptions:)
delegate method is now bridged to Swift as a[UIApplicationLaunchOptionsKey: Any]?
, rather than an[NSObject : AnyObject]?
.Therefore you'll need to update your implementation to reflect this change:
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.