1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] flutter_facbook_auth is showing -canOpenURL: failed for URL: "fbapi:/" - error: "The...

Discussão em 'Mobile' iniciado por Stack, Novembro 5, 2024 às 11:52.

  1. Stack

    Stack Membro Participativo

    I have implemented Login with Facebook in my Flutter app using flutter_facebook_auth: ^7.0.0. It was working perfectly both for Android and iOS. However, all of a sudden the error below is generated only for iOS in real devices.


    -canOpenURL: failed for URL: "fbapi:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)" false [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(FAILED, The operation couldn’t be completed. (com.facebook.sdk.core error 8.), null, null)

    This is the snippet from my pubspec.yaml

    environment:
    sdk: '>=3.2.5 <4.0.0'

    dependencies:
    flutter:
    sdk: flutter

    # to add facebook login
    flutter_facebook_auth: ^7.0.0



    Snippet from my info.plist

    <key>LSApplicationQueriesSchemes</key>
    <array>
    <string>fbapi</string>
    <string>fb-messenger-share-api</string>
    </array>


    I have set the global iOS platform to 12.0 in my Podfile.

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


    Here is how my AppDelegate.swift file looks:

    import UIKit
    import Flutter

    @UIApplicationMain
    @objc class AppDelegate: FlutterAppDelegate {
    override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }
    }



    This is the main portion to handle login with facebook method:

    final LoginResult loginResult = await FacebookAuth.instance.login(
    //loginTracking: LoginTracking.limited,
    //nonce: nonce,
    );
    if (loginResult.status == LoginStatus.success) {
    print('................SUCCESS'); // this is successful
    // final AccessToken accessToken = loginResult.accessToken!;
    //
    final userData = await FacebookAuth.instance.getUserData();// <-- This is where getting the Error.


    Error from the log:

    [​IMG]

    Please, kindly help me solve the issue. Thank you all in advance.

    Continue reading...

Compartilhe esta Página