Facebook Analytics Getting Started Guide for iOS Swift
When you integrate the Facebook SDK for Swift, you can see the data collected by Facebook Analytics in your app dashboard. This topic assumes you use CocoaPods as the dependency manager for your Swift Cocoa projects. For more information about CocoaPods with you Swift app, see the Getting Started guide at https://guides.cocoapods.org/using/getting-started.html.
If you wrote your app using Objective-C, see Facebook Analytics for iOS-Quickstart to learn how to integrate the Facebook SDK for iOS to use Facebook Analytics.
This section shows how to install CocoaPods and create a pod file. If you already installed CocoaPods and created a pod file, go to the next section.
- In a terminal window, run the following command to install CocoaPods.
sudo gem install cocoapods
- Create a new Swift project. If you are using an existing project, go to the next step.
- In a terminal window, go to the project directory.
- Run the following command to create a pod file
Configure the pod files to use the Facebook SDK
- Add the following line to the pod file of your project:
- Open a terminal window and go to your project folder.
- Run the following command to install the Facebook SDK for Swift:
- Configure your information property list.
- See the results in Events Manager.
The Events Manager
displays the events you send to Facebook Analytics. If this is the first time you launched your app with this code, you may have to wait at least 20 minutes before your events appear.
Note: Events may take up to 20 minutes to appear in the dashboard.