Add Facebook Analytics in Buildbox iOS Game

Let me get to the point and see how we can add Facebook analytics in Buildbox exported ios game. 

  • Create new Facebook app from facebook developer console.
  • Add iOS platform and add package id
  • Go to root folder of the exported project
  • Open terminal and run pod init which will create a new file named ‘Podfile

Setup Pod

Open Podfile and add Facebook core pod dependency. 

Save and close file. Open terminal and run pod install command.

You will get an output similar to this

pod install
Analyzing dependencies
Downloading dependencies
Using Bolts (1.9.0)
Using FBSDKCoreKit (4.39.0)
Using nanopb (0.3.901)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 9 total pods installed.

Open BBPlayer.xcworkspace workspace. 

Facebook properties in info.plist

Now we have to add Facebook app information in our info.plist file

  • Right click on info.plist and open as Source Code
  • Add and replace property value as per your Facebook app id

Build Settings

  • Open build settings and add ${inherited} flag in other linker flags


Open file and add Facebook header 

#import <FBSDKCoreKit/FBSDKCoreKit.h>

Update didFinishLaunchingWithOptions function

Add openURL function

Build and Run

  • You are ready to test your ios game with Facebook analytics

Add Custom Facebook Analytics Events

Add header in

#include "screens/PTPScoreController.h"

Now you can add these two functions in your delegate.

screenOnEnter is called everytime when a new screen is opened. 

screenOnExit is called everytime when the screen is closed and navigated to a new screen. 

If you are looking to implement Facebook or Firebase analytics in Buildbox Android then you can check this article.

Leave a Reply