Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook Events doesn't work on Flutter App #2462

Open
5 tasks done
MasTeh opened this issue Aug 1, 2024 · 0 comments
Open
5 tasks done

Facebook Events doesn't work on Flutter App #2462

MasTeh opened this issue Aug 1, 2024 · 0 comments

Comments

@MasTeh
Copy link

MasTeh commented Aug 1, 2024

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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant