简体   繁体   中英

How to make Facebook App Events works on ios15?

On iOS15 don't see app events in Events Manager. Both on "overview" and "test events" tabs.

There is one important thing missed in facebook app events docs. To make facebook app events work on iOS 14+ app MUST request user for tracking. Here is example:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {[weak self] in
            self?.requestTracking()
        }
        return true
    }
    
    func requestTracking(){
                if #available(iOS 14, *) {
                    ATTrackingManager.requestTrackingAuthorization(completionHandler: { (status) in
                        switch status{
                        case .authorized:
                            Settings.shared.isAutoLogAppEventsEnabled = true
                            Settings.shared.isAdvertiserTrackingEnabled = true
                            Settings.shared.isAdvertiserIDCollectionEnabled = true
                            break

                        case .denied:
                            Settings.shared.isAutoLogAppEventsEnabled = false
                            Settings.shared.isAdvertiserTrackingEnabled = false
                            Settings.shared.isAdvertiserIDCollectionEnabled = false

                            break
                        default:
                            break
                        }
                    })
                }
        }

Otherwise Facebook app events will work only if app been authorised throw Facebook sign in.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM