1

I am currently integrating Facebook login through the Facebook SDK in iOS. So if i am currently having Facebook application installed in iOS, so if i login through Facebook in my application it should follow the under mentioned scenarios:

1) If the Facebook application is already installed then while clicking the Facebook login, the Facebook application should pop up.

2) Else if we don't have Facebook application it should divert to the web browser.

How to do this . Is it by manually through our coding or Facebook SDK manages it?

Jessica thompson
  • 407
  • 2
  • 8
  • 20
  • for authentication via Facebook app install on device please look https://stackoverflow.com/questions/5559061/how-to-authorize-user-through-a-dialog-with-the-new-facebook-connect-ios-api/5683454#5683454 https://stackoverflow.com/questions/8002260/first-dialog-after-authenticating-fails-immediately-and-closes-dialog/9137887#9137887 for manual, please follow this link https://www.appcoda.com/ios-programming-facebook-login-sdk/ – Gagan_iOS Jun 01 '17 at 07:46

1 Answers1

2

We can check we have a Facebook application or not. But if you redirect the user to Facebook app, then there will not any login page in the FB app. Because Facebook .native for loginBehavior uses Safari to open user login.

In that Safari browser, you will have one option to open in the app. The user can either click on that and authorise in-app itself or just go by writing credentials on safari.

Update:

We can check Whether the user has installed a Facebook app or not with URI Scheme. But before that you have to register like this in your info.plist:

Open info.plist as a Source Code like this:

enter image description here

And paste below code.

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fb</string>
</array>

Now check like this:

BOOL isFBInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]

if (isFBInstalled) { //Check if FB app installed
//Do something
}
Anurag Sharma
  • 4,276
  • 2
  • 28
  • 44