lysergic-acid lysergic-acid - 6 months ago 64
iOS Question

Should FB.ActivateApp be manually called on iOS

We are using the latest available version of the Facebook SDK for Unity (v7.2.2)

One of the available APIs is ActivateApp (FB.ActivateApp).

Should this method be called, specifically on iOS ?

Digging a bit into what's under the hood (the SDK is open source), I see that on iOS (in the file FBUnityInterface.mm), there's the following code:

- (void)didBecomeActive:(NSNotification *)notification
{
[FBSDKAppEvents activateApp];
}


It looks like ActivateApp is being called automatically (whether i manually call it or not).

Should we call FB.ActivateApp when our app starts / resumes? won't this cause duplicate app activation reports ?

Answer

Answering my own question:

On iOS, ActivateApp seems to be called automatically in iOS native code.

Invoking the FB.ActivateApp method does nothing (see this code from IOSFacebook.cs):

 public override void ActivateApp(string appId)
 {
     IOSFacebook.IOSFBSettingsActivateApp(appId);
 }

The called method is simply empty:

private static void IOSFBSettingsActivateApp(string appId)
{
}

So, this seems to be taken care of automatically on iOS.