facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.73k stars 3.5k forks source link

Facebook Login doesn't open the App when Installed #2374

Open OS-ricardomoreirasilva opened 1 month ago

OS-ricardomoreirasilva commented 1 month ago

Checklist before submitting a bug report

Xcode version

15.0

Facebook iOS SDK version

17.0.0

Dependency Manager

CocoaPods

SDK Framework

Login

Goals

When the Facebook App is installed on the device, when logging in through Facebook, the app is used instead of the In-App Browser.

Expected results

The In-App Browser is always used, regardless of whether or not the app is installed. This did not happen in previous versions.

Actual results

In-App Browser login is always triggered.

Steps to reproduce

No response

Code samples & details

No response

almahdc commented 1 month ago

Same.

OS-ricardomoreirasilva commented 1 month ago

@almahdc apparently, this is related to the Limited Login functionality (you can check in the "Limitation" section): https://developers.facebook.com/docs/facebook-login/limited-login/ios. I do not understand here that, if the tracking parameter defaults to enabled, why am I still getting the Limited Login instead of the classic one?

kuroky commented 1 month ago

@almahdc apparently, this is related to the Limited Login functionality (you can check in the "Limitation" section): https://developers.facebook.com/docs/facebook-login/limited-login/ios. I do not understand here that, if the tracking parameter defaults to enabled, why am I still getting the Limited Login instead of the classic one?

hi bro, have you resolved, with the new api, it still can't open facebook native app

   FBSDKLoginManager *loginManager = [FBSDKLoginManager new];
   NSArray *scopes = @[@"public_profile", @"email", @"user_friends"];
   FBSDKLoginConfiguration *config = [[FBSDKLoginConfiguration alloc] initWithPermissions:scopes
                                                                                  tracking:FBSDKLoginTrackingLimited 
                                                                                     nonce:@"123"];
   [loginManager logInFromViewController:nil
                            configuration:config
                               completion:^(FBSDKLoginManagerLoginResult * _Nullable result, NSError * _Nullable error) {
   }];
OS-ricardomoreirasilva commented 1 month ago

@almahdc apparently, this is related to the Limited Login functionality (you can check in the "Limitation" section): https://developers.facebook.com/docs/facebook-login/limited-login/ios. I do not understand here that, if the tracking parameter defaults to enabled, why am I still getting the Limited Login instead of the classic one?

hi bro, have you resolved, with the new api, it still can't open facebook native app

   FBSDKLoginManager *loginManager = [FBSDKLoginManager new];
   NSArray *scopes = @[@"public_profile", @"email", @"user_friends"];
   FBSDKLoginConfiguration *config = [[FBSDKLoginConfiguration alloc] initWithPermissions:scopes
                                                                                  tracking:FBSDKLoginTrackingLimited 
                                                                                     nonce:@"123"];
   [loginManager logInFromViewController:nil
                            configuration:config
                               completion:^(FBSDKLoginManagerLoginResult * _Nullable result, NSError * _Nullable error) {
   }];

Hey @kuroky!

From my understanding of the documentation, the code you posted will never trigger the Facebook App as having FBSDKLoginTrackingLimited will always use the Limited Login (that doesn't use the Facebook App). I haven't tried this myself but, from what I've read, you have to:

kuroky commented 1 month ago

@almahdc apparently, this is related to the Limited Login functionality (you can check in the "Limitation" section): https://developers.facebook.com/docs/facebook-login/limited-login/ios. I do not understand here that, if the tracking parameter defaults to enabled, why am I still getting the Limited Login instead of the classic one?

hi bro, have you resolved, with the new api, it still can't open facebook native app

   FBSDKLoginManager *loginManager = [FBSDKLoginManager new];
   NSArray *scopes = @[@"public_profile", @"email", @"user_friends"];
   FBSDKLoginConfiguration *config = [[FBSDKLoginConfiguration alloc] initWithPermissions:scopes
                                                                                  tracking:FBSDKLoginTrackingLimited 
                                                                                     nonce:@"123"];
   [loginManager logInFromViewController:nil
                            configuration:config
                               completion:^(FBSDKLoginManagerLoginResult * _Nullable result, NSError * _Nullable error) {
   }];

Hey @kuroky!

From my understanding of the documentation, the code you posted will never trigger the Facebook App as having FBSDKLoginTrackingLimited will always use the Limited Login (that doesn't use the Facebook App). I haven't tried this myself but, from what I've read, you have to:

  • Use FBSDKLoginTrackingEnabled.
  • Add the AppTrackingTransparency permission to your app.

hey @OS-ricardomoreirasilva thanks! follow your step, i can open facebook app now

  1. facebook app AppTrackingTransparency enable
  2. my app AppTrackingTransparency enable
  3. insure iPhone Setting -> Privacy&Safety -> Allow Track enable
  4. Use FBSDKLoginTrackingEnabled to init FBSDKLoginConfiguration

that work

almahdc commented 2 weeks ago

Update: this doesn't seem as a bug. They just changes the behaviour:

Also, .enabled for FBSDKLoginConfiguration is the default, so you don't have to change anything around your code most likely.

OS-ricardomoreirasilva commented 2 weeks ago

Update: this doesn't seem as a bug. They just changes the behaviour:

  • Users who don't allow transparency tracking will not be redirected to the FB app but just to web.

Also, .enabled for FBSDKLoginConfiguration is the default, so you don't have to change anything around your code most likely.

Still, they introduced a breaking change without updating the official documentation (and even the transparency tracking need is not very much mentioned). And considering the number of people who came here with the same issue, it's definitely an issue. It may not be a bug per se but it's a huge lack of commitment with the community.