I have added the the correct Facebook sdk values into info.plist as the Quick Start guide shows & added the SDK using the package manager, but I still get this error
Thread 1: App ID not found. Add a string value with your app ID for the key FacebookAppID to the Info.plist or call [FBSDKSettings setAppID:]
.
The app Id is 100% correct & it is in my info.plist. If I set the name & app Id in my app delegate I just get this error instead:
Thread 1: fbappid is not registered as a URL scheme. Please add it in your Info.plist
It seems as though the Facebook SDK can't find any values in my info.plist?
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb823445029398455</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>823445029398455</string>
<key>FacebookDisplayName</key>
<string>vertoo-dev</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbapi20160328</string>
<string>fbauth</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
This is a screenshot of my error
Add this in new file
class AppDelegate: NSObject, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// Initialize Facebook SDK
FBSDKCoreKit.ApplicationDelegate.shared.application(
application,
didFinishLaunchingWithOptions: launchOptions
)
return true
}
}
Tested in Xcode 12.5
make an AppDelegate.swift and add this code below.
import SwiftUI
import FacebookCore
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return ApplicationDelegate.shared.application(app, open: url, options: options)
}
}
next in your @main App file add this line
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
I had the same issue because I forgot to add fb
as prefix of App Id in URL Schemes.
Make sure that you've added like this fb{app_id}
into url schemes like image below.
Navigation to here: Project Navigator > Select Your Target > Info > URL Types
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With