Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDKApplicationDelegate Use of unresolved identifier

Tags:

I have two pods installed for facebook login

pod 'FacebookCore'
pod 'FacebookLogin'

than imported FacebookCore in appdelegate. still it shows use of unresolved identifier error.

unresolved identifier error

I have also implemented tags in info.plist

<array>
<string>fb---------</string>
</array>
<key>FacebookAppID</key>
<string>-----------</string>
<key>FacebookDisplayName</key>
<string>-----------</string>

Still not able to get SDKApplicationDelegate.

func application(_ app: UIApplication, open url: URL,
                 options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
    if SDKApplicationDelegate.shared.application(app, open: url, options: options) {
        return true
    }
    return false
}
like image 743
Krutika Sonawala Avatar asked May 15 '19 08:05

Krutika Sonawala


2 Answers

Its because SDKApplicationDelegate is changed to ApplicationDelegate

func application(_ app: UIApplication, open url: URL,
                 options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
    if ApplicationDelegate.shared.application(app, open: url, options: options) {
        return true
    }
    return false
}

One more thing to do

class AppDelegate: UIResponder, UIApplicationDelegate

Also import these two pods

import FBSDKCoreKit
import FBSDKLoginKit 
like image 115
Wings Avatar answered Sep 28 '22 08:09

Wings


Details

  • Xcode Version 10.3 (10G8)
  • Swift 5
  • FacebookCore (0.7.0)

Solution

just replace SDKApplicationDelegate with ApplicationDelegate

Code

import FacebookCore

//....

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)

    return true
}

//....

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
    guard let urlScheme = url.scheme else { return false }
    if urlScheme.hasPrefix("fb") {
        return ApplicationDelegate.shared.application(app, open: url, options: options)
    }
    return true
}
like image 31
Vasily Bodnarchuk Avatar answered Sep 28 '22 08:09

Vasily Bodnarchuk