ios 6: prompt user to log into facebook - iphone

I'm using UIActivityViewController to use facebook integration within my app. I've observed that in order for the Facebook option to be displayed in the list of displayed options, the user needs to be logged into Facebook on their device in the settings prior to entering that UIActivityViewController.
I'd like to prompt the user to log into Facebook and allow my app access to their account prior to invoking the UIActivityViewController. Is there a way to prompt the user to log into Facebook on their device (I guess I'm looking for a redirect or hook to the Settings app, with a callback)?
Note: I'd like to avoid using the Facebook SDK, and use the purely Apple supplied framework.

It's not possible with UIActivityViewController.
But you can achieve same function via SLComposeViewController.
I created a forked project OWActivityViewController that implement the same function as Apple's built-in Photos app's share action sheet through SLComposeViewController.
OWActivityViewController use the purely Apple supplied framework, compatible with iOS 5, hope this could help you somehow.

Related

How to launch FB app from URL (specifically the share function)

I'm looking for a way to replicate this:
https://www.facebook.com/sharer/sharer.php?u=http://www.buildfire.com
But I want to force it to use the Facebook App - I know that you can launch the FB app using this command
fb://
but have not been able to recreate the sharer function.
Any ideas? I can share in WhatsApp using
whatsapp://send?text=Check%20out%20this%20site%20http://buildfire.com/
Note: This is for mobile devices only that is why I want to force it to use the FB app
Direct deep-linking into the Facebook App, or better, into a specific section of the app (Share Dialog, User Profile etc.) using the Custom URL Scheme of the Facebook iOS app is not officially supported.
You can however add the FBSDKShareKit framework to your app and open a Share Dialog that way, see https://developers.facebook.com/docs/sharing/ios#share_dialog

How to do login with TWRequest in a user friendly manner?

After having a look at Apple TWRequest class (and example), I was surprised it has no possibilities for presenting a user with a login screen. The only way is to check if a user has entered its credentials with [TWTweetComposeViewController canSendTweet] and if no then give a message like
"Hey, you have manually to go to settings->twitter and enter the credentials. Then you should find and open our app manually and continue on"
I'm wondering does anybody use such crap functionality :) For example, Facebook iOS SDK 3 has implemented Single Sign On (SSO) that opens Safari with Facebook login screen and returns to your app after login... I guess I will need to fallback to old styled twitter integration with a lot of 3rd party stuff.
ps. I would give a try to ShareKit but I need to integrate my app with google+ which is not currently supported in ShareKit.

Facebook Integration in iOS app

I need to post a user-specific text, determined by him, on his wall/timeline when he presses a button (in facebook's tutorial, they make the user login when the app launches, and then it does nothing).
There is a lot of information on the internet but every site does it in other way.
Just wanted to know if there's a specific way to do it.
Thanks!
A quick easy way to add facebook to your app is ShareKit (http://www.getsharekit.com/). This also allows you to add other social network site to your app.
You might want to try Socialize: http://www.GetSocialize.com. It'll allow app users to comment & like within the app, with the option of also sharing out to a social network (Facebook currently live; Twitter coming). Full feature list at http://go.GetSocialize.com/features
DROdio

Connect to Facebook using Facebook app on iPhone

How to connect to Facebook using the downloaded Facebook app, and not the embeeded Facebook connect. This is done for example with Rockmelt app.
What seems to be done, is to launche a third party app using the url like (fb:some paramaeters) and having a callback url with your app (myapp://authentification parameter ).
The interest of this is that if you are already logged on facebook, you just need to approve or not your app.
What is missing, is what are the parameters to acheive this with the downloaded facebook app.
Just use the supplied Facebook Connect library as it handles all this for you. FBConnect by default will use single sign on either via the browser or the facebook app if already installed.
You can examine the source code of the FBConnect library to see how this is done if you wish, but I'd suggest that re-inventing the wheel is perhaps not the best way to go.

Facebook authentication with new 'Facebook SDK for iOS' vs. old 'Facebook iPhone SDK'

I'm working on integrating Facebook with my iPhone/iOS application and I want to know if I'm understanding the nature of the login procedure correctly.
With the old Facebook SDK ('Facebook iPhone SDK'), when we needed to request authentication permission from a user a UIWebView would be displayed with a login prompt. With the new SDK ('Facebook SDK for iOS'), the SDK uses Apple's fast-app-switching feature to temporarily place the app in background mode and then load the iOS Facebook app or Safari to authenticate. Is this basically the gist of it?
I've experimented with authenticating my app via the new SDK's technique and due to the nature of my app, it just can't support backgrounding. Does this mean I have to use the old SDK to launch a UIWebView-based authentication? I think this implementation is a lot cleaner anyway. Will I run into any major disadvantages from doing this?
Check out this question and my answer: Iphone facebook connect example calls safari. I don't want to use safari
You can make it use the UIWebView always. Facebook is trying to make it so the user only has to log in once per device (through either the Facebook app or in Safari) but I didn't like this flow (especially on the iPad). Though I'd rather not muck around with the Facebook code, I did find commenting out a few lines to be a quick way of getting the old behavior back.
I don't believe this is the case.
The Facebook SDK that I'm aware of, available at https://github.com/facebook/facebook-ios-sdk doesn't do anything like you describe. Is this the SDK you're using? I believe the last major update to this SDK from the "old" facebook SDK was to add support for OAuth-style authentication. With this change they broke code compatibility so apps were forced to make changes to incorporate the latest SDK.
When you call 'authorize' in this SDK you pass the app id, the desired permissions, and a callback delegate for notifications of errors or success (did login, did not login, did logout). You can also set any access token that you might have persisted from a previous session. Facebook validates this access token, and if it doesn't exist or is invalid it presents a modal login dialog. I believe the content of this dialog is a web page. The SDK authenticates the user using OAuth and makes the auth-token available for persisting between sessions.
At no time is the app exited to run the Facebook app or Safari. I'm curious - what led you to believe this was the case? (Or, perhaps there is some other SDK out there I'm unaware of?)
Take a look on this page: https://github.com/facebook/facebook-ios-sdk
And look at Single Sign-On. That describes the above scenario with fast switching.