5

I just use Facebook Analytics in my iOS app using FBSDKCoreKit 8.1.0 (latest)

This error message keeps flooding my log:

FBSDKLog: FBSDKGraphRequestConnection cannot be started before Facebook SDK initialized.

I don't even use the Graph API.

I've set up everything according to: https://developers.facebook.com/docs/ios/getting-started/

Any idea on how I can get rid of this?

themenace
  • 2,601
  • 2
  • 20
  • 33

3 Answers3

9

Turns out most of the warnings were sent because I forgot to execute this line, after the user accepted the terms & conditions:

ApplicationDelegate.initializeSDK(nil)

I already had these two setup, but the above was missing:

Settings.isAutoLogAppEventsEnabled = true
Settings.isAdvertiserIDCollectionEnabled = true

What confused me was, that it was working before and an update of the FBSDKCoreKit must somehow have broken it.

The warning will still show up for no reason in the app's startup phase. This is also mentioned in this stackoverflow question. Let me know if you have a fix for this one.

themenace
  • 2,601
  • 2
  • 20
  • 33
  • I'm using Flutter and not familiar with Swift. Would you please kindly show a complete code example how to implement `ApplicationDelegate.initializeSDK(nil)`? – Zenko Mar 17 '21 at 00:56
  • 1
    @Zenko Well this question is about the facebook iOS SDK, so it does not apply to Flutter. Anyway, let me google it for you: https://pub.dev/packages/facebook_app_events <- I think this is what you'd need :) – themenace Mar 18 '21 at 09:51
  • Thank you for helping out. I got it working now. Finally the third party package I was using just updated their repository with the fix. But I will take your solution in mind if anything arise. – Zenko Mar 19 '21 at 03:43
  • You're welcome. I'm glad to hear that you could make it work :) – themenace Mar 21 '21 at 14:37
  • Can you tell me where to put the link in Swift i have written native code in swift Flutter – Kartik Malhotra Jun 13 '22 at 12:53
0

XCode 13 & iOS 15

For my case, I was missing this line of code:

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

as referenced in the documentation: iOS - Facebook Login (see: step 5)

Soufiane ROCHDI
  • 1,543
  • 17
  • 24
-1

in application delegate add(check) the code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{
    // add the code in here
    [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
    
....
....
....
}
iHTCboy
  • 2,715
  • 21
  • 20
  • 1
    It's really not clear how this answers the question. Can you add some explanations to your answer? – joanis May 14 '21 at 20:14