IOS app that displays a Facebook group - ios

I would like to know what is the best way to show a Facebook group in an iOS app.
I have a iOS app that uses Facebook logins for the users to access content. I thought I might be able to display the a Facebook group using a UIWebView. The problem is when the Facebook group webpage the opened, the user is presented with a login. As the user has already logged into my app using Facebook, I am wondering if its possible to use the current access token to inform Facebook that the user is already logged in.
If that doesn't work, how else could I add a Facebook Group to a iOS app? Is there a sample app somewhere that displays Facebook page is a UIViewController?
Thanks

To the best of my knowledge, if you want to show FB content in a UIWebView, the user must perform the login inside the UIWebView. You cannot share your access token with the web-view.
A possible solution would be to use the graph API (you're already using the FB iOS SDK, right?) to retrieve the group info, feed etc. and show it to your users. The downside is that you'll have to create and display the group info yourself with your own design.
You can take a look at the FB graph API for groups here.

Related

facebook SDK, invite friends

I am developing an app, and users will be able to log in with Facebook. They only can start using the app if a minimum of their Facebook friend are already using the app. If not, they have to wait until the minimum required number of friend use the app in order to use it. I want to allow them to invite their Facebook friends to join.
Also, I would like to know how I can make it happen?
Do I HAVE TO create a facebook canvas or is there any other ways I can make it works?
Thank you for your help.
https://developers.facebook.com/docs/apps/faq#invite_to_app
Games on Canvas: App Request
Other Apps/Games: Send Dialog or Message Dialog
You can't access invitable_friends without enabling facebook canvas in your app's settings, but maybe app requests safisfy your needs? It will list friends (user needs to authorise reading friends list by app) and allow user to send them a notification in their mobile facebook app which will open an app or take user to app's page in App Store if they haven't installed your app yet.
Remember to enable deep linking, facebook SSO and provide App Store ID in platform settings for this work.
https://developers.facebook.com/docs/games/requests/

Adding a Facebook like button to our App

In my app I am allowing users to post to Facebook via the iOS API as follows:
SLComposeViewController * controllerSLC = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
I would like to add a Facebook 'Like' button for users who want to like our App. I have a couple questions:
1) Can a Facebook Like be accomplished using the Native iOS SDK? I could not find any reference so my assumption is no, but I was hoping for some clarification.
2) If I want a user to like our app on our Facebook home page, I believe the user has to be logged in to their account. SO, if the user is signed into Facebook on their device can I integrate the Facebook API's to that so the user does not have to log in again? I cannot find any solid iOS example of adding a like button to my app.
Thanks for any guidance.
There is a native like button under testing and you can find the documentation about it at https://developers.facebook.com/docs/ios/like-button . But be aware that only people will have a role on the app will see it so you can't currently use it.
If you are showing a webview the user will not be logged in in that webview even if they are logged in in the Facebook app. Same thing with redirecting to the browser. If the user is logged in in the Facebook app doesn't mean they will be logged in in the browser.

Accessing user photos with Facebook Graph API

I'm fairly new to iOS development and I have an app that already enables a user to login with Facebook. My question has two parts...
1) I don't necessarily want to ask for the "user_photos" permission upon login/signup, just when the user goes into their "edit profile" page and wants to grab some of their Facebook photos for their profile. How can I request additional permissions, beyond the ones I requested upon signup later in my app?
2) I also would like to know how to access a user's photos using the Facebook Graph API. I'd like that modal view from Facebook to appear that presents a user with all their albums and photos. I see a lot of documentation on the Facebook developer site about accessing a user's profile picture (I've already done this) and accessing specific photos, but, in this case, I don't know what specific photo I want. I want the user to select one of their photos, and certainly don't want to request ALL their photos. Does anyone know how to format a FB request so I can get that Facebook view to appear that allows a user to pick from all their photos?
Thanks,

Restricting Facebook invite dialog to non-app users?

I am creating an iOS app where the user can invite their friends to use the app using Facebook SDK [FBWebDialogs presentRequestsDialogModallyWithSession:message:title:parameters:handler: method. However, I don't want to show the users that already have the app. I know how to check if a user is an app user or not (using the Graph API, checking the is_app_user field), but how can I make the request dialog to exclude the users that are already users of my app to avoid confusion to the user? Is there any way to achieve this other than the method described here: https://stackoverflow.com/a/18583650/811405?

Linking Facebook Graph on iOS app and Web app

So I've searched for this topic a lot and may be over complicating things but would love some clarity on it. So here's the issue.
I have a web app that uses Facebook Graph (FB Login, friends invite, sharing through FB, etc). We've just built an iOS app for the website and now want to implement all the above FB actions on the iOS app as well. I looked up the Facebook documentation and have tried using that to getting just the Facebook login to work for a user that's already registered on our website (and has their Facebook account connected as well) but it doesn't seem to work.
Use case - A user registers on the web app and connects their FB account with us. They then download the iOS app and want to use FB login to login to the iOS app or share objects on their timeline. A vice versa case should also apply.
Question - What should be the workflow between the ios App, web Server and Facebook for the use case above? Basically, how is the token and the secret passed so all three know we're talking about the same user and same FB account?
Any links or advice would be highly appreciated! Thanks!
In the case when a facebook authed webapp user first starts the native app, you won't know who they are. So they need to be prompted with a "login with facebook" button. When they hit that button, the facebook-ios-sdk will figure out who the logged in user is and then check if that user has already granted your application access. If the web app and the native app both point to the same facebook app, then the facebook-ios-sdk will simply store the authed access token, and you'll have access to everything your web app does on the native app.
The key here is that your web app and native app must point to the same facebook app (ie. same app id in developers.facebook.com). If it didn't, then the native app user would be re-prompted to grant permissions when they click the "login with facebook" button. Additionally, it's important that the user is logged into the same facebook account on the web app (which is based on cookies in the browser) and on the phone itself. The facebook-ios-sdk uses a couple of different ways to look for the active facebook account on the phone. It tries the iOS 5+ system facebook account, inter-app calls to facebook's own native app, the browser cookie for the web view instance running in your app, or bounce you out to safari and use the browser cookie in safari. Which ever one comes back first saying they have an active facebook account needs to have found the same facebook account as the one on the web app. In most cases, they will match up because most users only have a single facebook account and are logged in everywhere with the same account, but they certainly can be different. In the off chance that the web app facebook user is not the same as the native app active facebook user as detected by facebook-ios-sdk, then the "login with facebook" button will simply prompt the native app active facebook user to log in and grant permissions.
Once the access token has been granted to the native app, you can send it back to the server, find the associated facebook user id, and now the web app user and the native app user can be linked to be the same person operating both apps. Additionally, any graph api calls you want to make on the server can be made on behalf of the user using the up-to-date access token you just got from the native app. Any sharing/posting/api calls made directly in the native app through the facebook-ios-sdk will be done as this user and will be handled by the sdk (ie. you won't need to worry about it... it should just work seamlessly and integrate all posts to their timeline just like the web app's graph apis can).
In the case where you have a facebook authed native app user going to the web app, you also won't know (on the first request) who this user is. You can present them with a facebook js sdk login and, again, once the same facebook user logs in, you can associate this current web app user as the one who was on the native app earlier.
Specifically addressing your question, you really have no way of knowing who a migrating user is on either the web app or the native app when they first come to the app. That's where the "login with facebook" comes in. Assuming the user is logged into the same account on the browser as well as on their phone (as determined by the facebook-ios-sdk), then the process of logging into your app is seamless. They won't be prompted to grant permissions a second time (unless your permissions set is different between the web app and the native app) and you'll be given the user's access token immediately. The role of the server is to reconcile the two users by using the granted access token. With the access token, the server can make a simple call to the graph api and get the user's facebook user id. Using that facebook user id, you'll be able to match up the "true" identities of the users on your apps (ie. you now know that the web app user and the native app user are one and the same). Once you know who the user is, you'll be able to provide a personalized experience to that user, based on his identity, regardless of whether he's using your web app or your native app.
Hope this helps. Happy to answer more questions that you may have.

Resources