'Setting up Facebook SDK for post processing leads to error messages in console

I have no clear effects from this, but am in the final phases of a project and am trying to heed any warnings. I receive 3 warning logs from FB each time I launch in the Xcode console when adding the following line to App Delegate under application(_:didFinishLaunchingWithOptions):

FBSDKCoreKit.ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)

"...FBSDKLog: FBSDKGraphRequestConnection cannot be started before Facebook SDK initialized."

If I remove this line of course then if I attempt to log in with Facebook post processing does not complete and the login does not occur. So, sanity check: am I to ignore these warnings?



Solution 1:[1]

Facebook requires a line for post-processing in AppDidLaunch, which the first time the app launches will run prior to the SDK being initialized: https://developers.facebook.com/docs/ios/graph/. The line is therefore moot when you first launch, but FB is happy to clog your console anyway. If you remove this line FB will be unable to process a login appropriately in an app, so we will have to live with this meaningless "warning."

Solution 2:[2]

I just came across this warning. In my case it showed up constantly and not only on startup. The reason was that I had configured this in my Info.plist.

<key>FacebookAutoInitEnabled</key>
<false/>

I fixed this by executing this after the user has accepted the terms and conditions:

ApplicationDelegate.initializeSDK(nil)

Disclaimer: This doesn't answer the question directly, but I wanted to post it here since many people may end up here googling for this error message. I now have the same issue as stated in the question above and I don't know how to get rid of the warning on startup.

UPDATE for iOS SDK version >= 9.0.0

With version 9.0.0 the FacebookAutoInitEnabled flag was removed, and one needs to initialize the SDK explicitly with the initializeSDK method or implicitly by calling it in applicationDidFinishLaunching.

?? CHANGELOG

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mike Pandolfini
Solution 2