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

Upgrade from 14.0 to 16.0, The App launch time has increased 100ms #2193

Open
5 tasks done
xidipeng opened this issue Apr 8, 2023 · 2 comments
Open
5 tasks done

Comments

@xidipeng
Copy link

xidipeng commented Apr 8, 2023

Checklist before submitting a bug report

Xcode version

14.2.0

Facebook iOS SDK version

16.0.1

Dependency Manager

CocoaPods

SDK Framework

FBSDKLoginKit

Goals

Upgrade from SDK 14.0 to 16.0, My project is OC,The App launch time has increased 100ms.

FB SDK

Expected results

Hope to optimize the SDK in launch.

Actual results

no stack trace

Steps to reproduce

No response

@nolimitdev
Copy link

nolimitdev commented May 3, 2023

Really someone initializes FB SDK as recommended in doc at app start? I immediately knew that it is not good idea. I do it after user request sign in via facebook only...

MyLoginManager.swift

import FBSDKLoginKit;
import Foundation;
import GoogleSignIn;

class MyLoginManager: NSObject, LoginButtonDelegate {

...

    public func initAppleLogin() {
        ...
    }

    public func initGoogleLogin() {
        ...
    }

    public func initFacebookLogin() {
        // (!!!) Init FB SDK now, not at app start because of performance reason
        FBSDKCoreKit.ApplicationDelegate.shared.application(UIApplication.shared, didFinishLaunchingWithOptions: nil);

        // Logout before sign in to avoid dialog that user already logged in
        let facebookLoginManager = FBSDKLoginKit.LoginManager();
        facebookLoginManager.logOut();
        
        // Fake login button
        let loginButton = FBLoginButton(frame: .zero);
        loginButton.permissions = ["public_profile", "email"];
        loginButton.delegate = self;
        loginButton.isHidden = true;
        loginButton.sendActions(for: .touchUpInside);
    }

    func loginButton(_ loginButton: FBLoginButton, didCompleteWith result: FBSDKLoginKit.LoginManagerLoginResult?, error: Error?) -> Void {
        ...
    }

    func loginButtonDidLogOut(_ loginButton: FBLoginButton) -> Void {
        ...
    }

    ...

}

Btw consider disabling FB useless bloatware...
Info.plist

<key>FacebookAdvertiserIDCollectionEnabled</key>
<false/>
<key>FacebookAutoLogAppEventsEnabled</key>
<false/>

@eXhausted
Copy link

Any updates? latest version adds even more, we have increase up to 200ms.

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

3 participants