How do I use Facebook Login via Facebook App for iOS - ios

I have a little problem. I am sing Facebook's API to get users information. I am using the code that provide here: https://github.com/pedro1993/ios-howtos
In those examples, when somebody logs in with Facebook they are taken to the Facebook app, whereas when in my app, Facebook is opened in a UIWebView. How can I stop that from happening and use the Facebook app?
Here is an example:
Peter

Follow this official tutorial instead https://developers.facebook.com/docs/facebook-login/ios/v2.0
Update Facebook SDK has several fallback behaviors to try before it falls back to in-app web view. You can debug it by setting breakpoints in corresponding places in code. From the look of it https://github.com/facebook/facebook-ios-sdk/blob/296771f5ed7674fcbed9c31cf39bf9c8e4706403/src/Login/FBSession.m#L1039 seems like a good place to start.
Especially try to debug -[FBSessionAppSwitchingLoginStategy tryPerformAuthorizeWithParams:session:logger:.

Related

Google Plus iPhone API sign in and share without leaving app

I have integrated the Google+ API in my App for login and sharing posts. Problem with it, is that everything requires you to leave the app and then come back (it uses URL schemes for this). This is not the expected behavior. I would like to know if there is a way to directly open up the login dialog within the my app it self without going to safari.
I really want to avoid going back and forth between safari and my app.
I just implemented same thing for my application. I have used Google's Sign In SDK. it will present Webview controller inside your app and let you login with your account, after that it will dismiss the Webview controller and call a delegate to get info for user.
Please read and follow the steps from this link,
https://developers.google.com/identity/sign-in/ios/
hope it answers the question.

Apple rejected app 10.6 because Facebook opens Safari to login

I sent another version of my app, that allow users to login via Facebook. Of course, I use official Facebook iOS SDK.
But Apple twice rejected my app with following reason:
The app opens a web page in mobile Safari for logging in, then returns the user to the app. The user should be able log in without opening Safari first.
I tried to get more info, and reviewer's answer was:
Thank you for your response. We reviewed your app version 3.2.1 and when the user taps Facebook to login, the user is taken to mobile Safari and then back to the app.
It provides poor user's experience and not in compliance with the Guidelines.
and
Thank you for your response. It would be appropriate to allow the users to login inside the app without redirecting to mobile Safari.
Why only my app got this error, when dozens of apps using Facebook iOS SDK this way and don't get rejects?
Is there way in Facebook iOS SDK to open login page inside app?
Facebook SDK 4.0+
FBSDKLoginManager *login = [FBSDKLoginManager new];
if (![UIApplication.sharedApplication canOpenURL:[NSURL URLWithString:#"fb://"]])
{
login.loginBehavior = FBSDKLoginBehaviorWeb;
}
It will prevent to open through Safari.
The same issue happens with the Google+ SDK, the app could be rejected for the same reason:
Reasons
10.6: Apple and our customers place a high value on simple, refined, creative, well thought through interfaces. They take more work but are
worth it. Apple sets a high bar. If your user interface is complex or
less than very good, it may be rejected
----- 10.6 -----
We found the following issue with the user interface of your app:
The app opens a web page in mobile Safari for creating an account or
logging in for Google+ account, then returns the user to the app. The
user should be able to create an account or log in without opening
Safari first.
So the best solution is to move the server-side oAuth 2.0 through the Embedded WebView where the SDK does not let you to handle this automatically (like the Facebook SDK), at least until those SDKs does not make an update to handle the Embedded WebView use case.
Now Apple made their rules stricter.
You can find answer for your question in official Facebook documentation here.
Chapter "Embedded WebView Login Dialog"
The Facebook SDK for iOS provides various login experiences that your app can use to authenticate someone. This link includes all the information you need to know in order to implement Facebook login in your iOS app.Or Check ray wenderlich tutorial Facebook Tutorial for iOS: How To Use Facebook’s New Graph API from your iPhone App

Facebook Messenger App Link [iOS]

I'm creating an iOS application where I'd like to integrate Facebook Messenger for users to message each other. I've tried deeplinking via fb-messenger://user-thread/{user-id}, which works as intended. When I open the URL via my app, it switches over to Facebook Messenger. However, as this type of link seems undocumented by Facebook, I'd rather not risk using it as they might change it at any given time.
I've then looked into Facebook App Links, but as they're very few examples of how to actually use it, I'm not completely sure how to use it for a simple case of switching from my own app to messenger with a user-id as a parameter.
Any comments on this matter will be much appreciated.

Initiate Facebook Group Chat from iOS App

I want my app to create a new Facebook group chat with certain people that opens either on Facebook's site in Safari or in the native Facebook app when the user presses a button. I want Facebook to handle the whole chat and my app only to initiate it somehow in the cleanest and least involved way possible. My app already uses the Facebook SDK to open an active FBSession, so I've already got login credentials.
Looking around online and in Facebook's docs, I can't find anything that suits my needs. The closest thing I found was in this answer containing a list of Facebook app URLs you can connect to that open the Facebook app to certain pages. There's "fb://chat/(initWithUID:)" and "fb://messaging/compose/(initWithUID:)". However, not only is there no explanation on how to use these, but people say that Facebook has changed these URLs (and does not have any documentation on them), so they don't work anymore unless I reverse-engineer new URLs (which could change again). Ugh, so close!
I also found examples on starting chats with the Facebook Chat API, but that involves logging into Facebook using some networking framework then writing my own GUI and model for sending messages, which I am only prepared to do as a last resort. There should be some way to let the Facebook app or website do all that. Does anyone know how I can do this?
I've found something very close, but I still don't see a way to make my app initialize it with the desired group of friends:
The Facebook SDK has a message dialog that can appear for sending messages to friends. This isn't exactly what I wanted but is good enough because it means that all the programming is already done for me by Facebook, and users should be able to see these messages on https://facebook.com and the Facebook apps. https://developers.facebook.com/docs/ios/share#message-dialog

Sharekit and Facebook URL sharing

I know there is a lot of these questions here, but Facebook seem to change their system now and then.
Is it possible to use Sharekit to send a URL to the status of the user (obviously with their permission) telling others about the app and with the URL for the app?
Every time I try to implement this I just end up in Facebook full on. Can't even get back to my own app with a cancel button. I have followed several suggestions all over the Net with no success.
Would love to have the Facebook Share come up as a actionsheet within the app.
Does anyone have a solution?

Resources