I'm having a nightmare trying to install the Facebook SDK on iOS for app events analytics. The facebook documentation is terrible, and inconsistent, and I can't find any up to date installation documents that work. All I want to do is install the SDK so that I can track app installations and app open events. I'm using cocoapods for installation
pod 'Facebook-iOS-SDK'
In my app delegate didFinishLaunchingWithOptions I have the following code
import FBSDKCoreKit
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
Settings.isAutoLogAppEventsEnabled = true
Settings.isAdvertiserIDCollectionEnabled = true
Settings.loggingBehaviors = [LoggingBehavior.appEvents,LoggingBehavior.networkRequests]
return true
}
// ...
}
In my info.plist I have the following as per the documentation:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb396923698487528</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>396923698487528</string>
<key>FacebookDisplayName</key>
<string>Where4Test</string>
And from the logs it shows the analytics events sending and returning with success to the facebook api. But in the event manager https://www.facebook.com/events_manager2 no events are showing and it says I still haven't installed the SDK.
I've tried a million different things, but just can not get the events to register with facebook. Please can someone give an up to date installation instruction or see something I'm doing wrong!

The solution to this problem was to request ad tracking permissions from the user as follows
Facebook documentation doesn’t mention this as a required installation step for the app events to work, but it turns out it is. This isn’t for any coding reason but instead because of legal compliance reasons. They really should say it is a necessary step and inform you that events won’t be tracked in the SDK logs if you haven’t requested authorisation.