Facebook-ios-sdk: Takes time execution in pre-main, should can be lazily

Created on 4 Oct 2019  路  4Comments  路  Source: facebook/facebook-ios-sdk

Environment

  • Xcode Version: 11.1
  • Swift Version: 5 (if issue is Swift related)
  • Installation Platform & Verison: Cocoapods version 1.7.0

Goals

decreasing initializing SDK on startup.

Expected Results

SDK can be lazy initializing.

Actual Results

this SDK takes time to be initialized

Steps to Reproduce

just play instruments with an app was integrated the SDK.

Code Samples & Details

As mention in WWDC to avoiding some concern about using +[Class load]. may this block function be in the initialize?

https://github.com/facebook/facebook-ios-sdk/blob/master/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m#L67

// to using 
+ (void)initialize
// rather than
+ (void)load
{
  if ([FBSDKSettings isAutoInitEnabled]) {
    // when the app becomes active by any means,  kick off the initialization.
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(initializeWithLaunchData:)
                                                 name:UIApplicationDidFinishLaunchingNotification
                                               object:nil];
  }
}

Screen Shot 2019-10-04 at 07 25 12

Most helpful comment

At a glance this seems reasonable and like a good idea. If you are able, please open a pull request with this change and we will make sure it is reviewed in a timely fashion. :)

All 4 comments

At a glance this seems reasonable and like a good idea. If you are able, please open a pull request with this change and we will make sure it is reviewed in a timely fashion. :)

At a glance this seems reasonable and like a good idea. If you are able, please open a pull request with this change and we will make sure it is reviewed in a timely fashion. :)

Thanks for proposing a PR.
but I can't push the new branch.

_> haven't the correct access rights._

You can make a fork of the repo, commit changes on a branch there, and then open a pr to this repo from that branch. It鈥檚 worth learning as this is an essential technique for open source contributions to any library. 馃榾

https://help.github.com/en/articles/creating-a-pull-request-from-a-fork

Oh my...
馃槀
Thanks for remind

Was this page helpful?
0 / 5 - 0 ratings