Daniele B Daniele B - 1 year ago 147
iOS Question

iOS Swift 2.3: correct syntax for application restorationHandler?

I am trying to setup Firebase Dynamic Links in my iOS project using Swift 2.3.

When I add this function in the AppDelegate (as reported at the bottom of this page), I get the error:

Unknown attribute 'escaping'

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
guard let dynamicLinks = FIRDynamicLinks.dynamicLinks() else {
return false
let handled = dynamicLinks.handleUniversalLink(userActivity.webpageURL!) {
(dynamiclink, error) in
// ...
return handled

any idea which is the correct syntax for Swift 2.3?

Answer Source

The method which you are using is for swift3, here is the method for swift2.3

func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download