darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
191 stars 124 forks source link

How to upgrade version of Facebook SDK #364

Closed dbblackdiamond closed 6 months ago

dbblackdiamond commented 6 months ago

What version are you using?

5.0.11

What OS and version are you using to local deploy your application?

Lunix Mint 21.1

What platforms are you seeing the problem on?

Android, iOS, web

pubspec.yaml

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.5
  http: ^0.13.5
  flutter_bloc: ^8.1.1
  shared_preferences: ^2.0.16
  multi_select_flutter: ^4.1.3
  url_launcher: ^6.1.7
  firebase_auth: ^4.2.2
  firebase_dynamic_links: ^5.0.11
  firebase_core: ^2.4.1
  google_sign_in: ^6.1.4
  firebase_messaging: ^14.2.1
  flutter_local_notifications: ^14.1.1
  badges: ^3.1.1
  crypto: ^3.0.2
  dropdown_search: ^5.0.5
  intl: ^0.18.0
  crypt: ^4.2.1
  file_picker: ^5.2.5
  firebase_storage: ^11.0.10
  path_provider: ^2.0.11
  flutter_pdfview: ^1.2.5
  permission_handler: ^10.2.0
  toggle_switch: ^2.0.1
  excel: ^2.1.0
  place_picker: ^0.10.0
  currency_text_input_formatter: ^2.1.10
  multi_masked_formatter: ^1.0.0
  flutter_facebook_auth: ^5.0.11
  faker: ^2.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.1

Describe the Bug

I created an app in Facebook to use Facebook login for folks to log into my app, but I get a banner in Facebook saying that my Facebook SDK version is out of date and that I need to upgrade to at least version v5.0, but I can't find any documentation on how to upgrade the version of the Facebook SDK in use by flutter_facebook_auth.

Expected Behavior

N/A

To Reproduce

Create an app in Facebook to use Facebook login and configure Flutter app to use flutter_facebook_auth.

Relevant log output

No response

flutter doctor -v

[✓] Flutter (Channel stable, 3.13.5, on Linux Mint 21.1 5.15.0-86-generic, locale en_CA.UTF-8)
    • Flutter version 3.13.5 on channel stable at /home/bertrand/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 12fccda598 (3 weeks ago), 2023-09-19 13:56:11 -0700
    • Engine revision bd986c5ed2
    • Dart version 3.1.2
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /home/bertrand/Android/Sdk
    • Platform android-33-ext4, build-tools 33.0.1
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 19.0.2+7-Ubuntu-0ubuntu322.04)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed
      instructions).

[✓] VS Code (version 1.83.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.74.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Linux Mint 21.1 5.15.0-86-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 118.0.5993.70

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Info.plist (iOS)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTDPLIST1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>CADisableMinimumFrameDurationOnPhone</key>
        <true/>
        <key>CFBundleDevelopmentRegion</key>
        <string>$(DEVELOPMENT_LANGUAGE)</string>
        <key>CFBundleDisplayName</key>
        <string>{AppName}</string>
        <key>CFBundleExecutable</key>
        <string>$(EXECUTABLE_NAME)</string>
        <key>CFBundleIdentifier</key>
        <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <string>hustlinhome</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>$(MARKETING_VERSION)</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>$(CURRENT_PROJECT_VERSION)</string>
        <key>LSRequiresIPhoneOS</key>
        <true/>
        <key>UIApplicationSupportsIndirectInputEvents</key>
        <true/>
        <key>UILaunchStoryboardName</key>
        <string>LaunchScreen</string>
        <key>UIMainStoryboardFile</key>
        <string>Main</string>
        <key>UISupportedInterfaceOrientations</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>UISupportedInterfaceOrientations~ipad</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>UIViewControllerBasedStatusBarAppearance</key>
        <false/>
        <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
        <string>Used for navigation</string>
        <key>NSLocationWhenInUseUsageDescription</key>
        <string>Used for navigation</string>
        <key>NSPhotoLibraryUsageDescription</key>
        <string>Used to access photos</string>
        <key>LSApplicationQueriesSchemes</key>
        <array>
            <string>googlechromes</string>
            <string>comgooglemaps</string>
            <string>fbapi</string>
            <string>fb-messenger-share-api</string>
        </array>
        <key>CFBundleURLTypes</key>
        <array>
            <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>fb{AppId}</string>
            <string>com.googleusercontent.apps.{GoogleInfo}</string>
                </array>
            </dict>
        </array>
        <key>FacebookAppID</key>
        <string>{AppID}}</string>
        <key>FacebookClientToken</key>
        <string>{Client-Token}</string>
        <key>FacebookDisplayName</key>
        <string>{AppName}</string>
    </dict>
</plist>

Podfile (iOS)

# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package={PackageName}>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
   <queries>
       <provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
   </queries>
   <application
        android:label="hustlinhome"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <meta-data
        android:name="com.facebook.sdk.ApplicationId" 
        android:value="@string/facebook_app_id" />
    <meta-data 
        android:name="com.facebook.sdk.ClientToken" 
        android:value="@string/facebook_client_token" />
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
        <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value={GeoKey}/>
    </application>
</manifest>

MainActivity.java

No response

MainActivity.kt

No response

index.html

No response

Info.plist (macOS)

No response

darwin-morocho commented 6 months ago

in your pubspec.yaml change the version to 6.0.2 next follow this https://facebook.meedu.app/docs/5.x.x/migration-guide

dbblackdiamond commented 6 months ago

That worked. Thank you.