Login with facebook button with Parse - ios

I'm working on an app that uses Parse backend, and I've implemented Facebook login following Parse's tutorial. I am not using PFLoginViewController provided by Parse, only the login method calls to the PFFacebookUtils class. The implementation works well.
What I now need is the 'login with Facebook' button. Since I'm not using LoginViewController, I can't use the loginView property that would give me the button. Nor can I use the FBLoginView from Facebook SDK as the view neither surfaces the button nor allows one to override the method that is called when the button is clicked.
What is the best way to extract the button from existing SDKs - either Parse or Facebook - so that the button is always visually up to date?

Related

TwitterKit doesn't have interface to control redirection to native twitter app

Currently I use TWTRTweetView from TwitterKit to display the tweets. When I tap on the tweet, the iOS system's popup shows up "MyAppName" wants to open "Twitter", and gives 2 buttons, Cancel and Open respectively.
Then the problem is no matter which button I press on, it will redirect to the twitter native app.
Ok, I have downloaded their source code and looking into it. And I drew a flow diagram to illustrate the issue.
As the diagram shows, the twitter SDK will try to call the deep link on tap first, if user taps "cancel" on the apple's default pop up, then the SDK will try the second attempt by calling universal link. This will cause the issue as I described in the question, which is even user taps on "cancel", my app still redirects to twitter app.

How to know coming back from Facebook?

How is it possible to test / get notification about Facebook iOS app is just left?
Implemented Facebook Login button, and when coming back from FB login screen, need to do some extra steps in my app. But viewDidAppear is not get called in that view controller.
Do you have any idea? Need to use AppDelegate methods?
You can add an observer for UIApplicationWillEnterForeground notification.
And you could add some logic right before calling the facebook button, to check if the app has entered background because of that or simply because the user has pressed home button.

ios: programmatically ask for Game Center sign-in?

I have a simple question, but I’ve looked through Apple’s documentation and done some searching and I can’t find the answer to it.
Is it possible to programmatically pull up Game Center’s sign-in view? I have a UIButton that requires Game Center, and if the client does not sign in when the app is opened (iOS pulls up the sign-in view at launch), I want to provide a second chance for the user to sign in.
I'm assuming you're calling this GKLocalPlayer method on launch: -setAuthenticateHandler: (>= iOS7) or -authenticateWithCompletionHandler: (<= iOS6)
If the user cancels the presented login screen, calling these methods again does nothing, or rather, the completion handler is called with an error. The user will then need to login to GameCenter through the GameCenter app or through the Settings app. (While testing, you can login through the GameCenter app, then logout. After that the screen can be presented in your own app again.) You can show an UIAlertView telling the user to login through the GameCenter app.
Alternatively, and I don't know if this is allowed/approvable, but in iOS7 the authenticateHandler has a viewController parameter holding the login screen. If you store this login view controller in an instance variable and the user cancels login, you can present the login screen again later using a UINavigationController.
If you try to present the saved login view controller with -presentViewController:animated:completion: the view controller's Cancel button no longer works, but using a UINavigationController hides the Cancel button and allows navigation back to your own view controller.
You'll also need to hide the login screen manually after the user logs in by responding to GKPlayerAuthenticationDidChangeNotificationName. It doesn't seem like developers were intended to be able to do this, so it may not pass approval, but it works!

How to return to app if user cancel Facebook Login?

I m working on facebook login. Everything is fine, when I tap on the login button it will take me to safari (or FB app) and ask me for FB login.
my question is how to make safari return to my app if I decide not to login and hit cancel button? its currently taking me to my facebook main page after hitting cancel and is not useful
thanks in advance!
I don't know how to do it exactly as you suggest but what you could do is create another view controller with a web view inside of it, and a navigation bar at the top that has a cancel button on it. This way they could log on to facebook from within the app, so they don't have to switch between things which can be a little lengthy! It would also allow an easy cancel button with 'dismissModalViewController' or whatever it has changed to in iOS6. I believe this should work :)

Facebook application authentication cancel button issue in iPhone

How do I get to know when the cancel button is clicked from a Facebook appliaction in iPhone while authentication.
We can get the callback for other through delegate functions, but I don't know how to get the callback for the cancel button.
Facebook provides a delegate method which you can use:
- (void)fbDidNotLogin:(BOOL)cancelled;
You have to implement FBSessionDelegate and this method will be called if the person clicks on the cancel button.

Resources