Reputation: 119
My function:
func application(application: UIApplication, didReceiveRemoteNotification userInfo: NSDictionary)
Shows this error:
Objective-C method 'application:didReceiveRemoteNotification:' provided by method 'application(:didReceiveRemoteNotification:)' conflicts with optional requirement method 'application(:didReceiveRemoteNotification:)' in protocol 'UIApplicationDelegate'
I saw on another post that it fixes by just "rewriting" the methods name. What does it mean? Change the name? Delete it and write it again?
Upvotes: 1
Views: 325
Reputation: 12367
Swift 1.2 further moves away from its Objective-C foundations by remapping some class methods from the NSDictionary
type to the native Swift [NSObject: AnyObject]
type.
Change your method header to this:
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject: AnyObject])
You can fix other errors of this sort by using the Swift conversion tool, which can be found in the Edit menu under "Convert" (Edit -> Convert -> To Latest Swift Syntax...
).
I assume what is meant by "rewriting" the method header in your other source is deleting the line and typing application(
, then selecting the didReceiveRemoteNotification
option from the popup menu and allowing autocomplete to do the rest.
Upvotes: 3