Sruthin Gaddam Sruthin Gaddam - 1 month ago 40
Swift Question

Implementation of application:openURL:sourceApplication:annotation

I started working on the app before the release of Xcode8 and and then switched over , When I try to log into the app using Facebook login I get the following error


Implementation of application:openURL:sourceApplication:annotation: not found. Please add the handler into your App Delegate. Class: GhostGab.AppDelegate


I checked all the settings and they seemed fine . Any help will be appreciated

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FIRApp.configure()
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}

func application(application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: AnyObject) -> Bool {

let facebookDidHandle = FBSDKApplicationDelegate.sharedInstance().application(
application,
open: url,
sourceApplication: sourceApplication,
annotation: annotation)
// Add any custom logic here.
return facebookDidHandle
}

Answer

I think your function defination of

func application(application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: AnyObject) -> Bool {

}

should be replaced by

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
}

There is a _ (underscore) in the first parameter and Any in place of AnyObject in the last parameter type, that's why you are getting

Implementation of application:openURL:sourceApplication:annotation