facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.8k stars 3.56k forks source link

Facebook Events doesn't work on Flutter App #2462

Open MasTeh opened 3 months ago

MasTeh commented 3 months ago

Checklist before submitting a bug report

Xcode version

15.4

Facebook iOS SDK version

17.0.2

Dependency Manager

SPM

SDK Framework

Core

Goals

I need to activate Facebook Events. It required for advertising company from Facebook. I can't choose the facebook application from list becouse in Event Manager displays message "Your app is out of date. To run your app on iOS 14, update to the latest Facebook SDK for iOS."

Expected results

There needs to be no message in Event Manager "Your app is out of date. To run your app on iOS 14, update to the latest Facebook SDK for iOS." and I could choose the project for starting of advertising company.

Actual results

Display message "Your app is our of date" although I have installed the last version of SDK.

Steps to reproduce

  1. I've added package dependency in XCode via Swift Package Manager and use the last version of SDK that downloaded from https://github.com/facebook/facebook-ios-sdk.
  2. I've inserted to AppDelegate.swift the code for initialize SDK using FlutterMethodChannel.
  3. I've configured my info.plist and checked that properties is right.
  4. I've added to Flutter code invoke method for calling Facebook SDK initialization after request of permission for tracking (it is required).
  5. I've checked that all work is correct. I've seen information about events in Facebook Event Manager, they have appear.

But the message didn't appear: "Your app is out of date. To run your app on iOS 14, update to the latest Facebook SDK for iOS." What I can do for solve this problem?

Code samples & details

// AppDelegate.swift

import UIKit
import FacebookCore
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {

  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {

    let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
    let facebookChannel = FlutterMethodChannel(name: "com.app.myapp/facebook",
                                                    binaryMessenger: controller.binaryMessenger)

    facebookChannel.setMethodCallHandler({
        (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
                    guard call.method == "FBSDKInit" else {

                        AppEvents.shared.activateApp()
                        ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
                        return
                    }
    })

    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

    override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        return ApplicationDelegate.shared.application(app, open: url, options: options)
    }

}

// Flutter
const platform = MethodChannel('com.app.myapp/facebook');
platform.invokeMethod('FBSDKInit');
minhx3 commented 1 week ago

Me too, please help