Accessing user photos with Facebook Graph API - ios

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,

Related

Review Said "Instagram profile permission(s) should not be used to authenticate new users in your app."

Okay, So I have seen multiple issues(answered and unanswered) regarding Instagram API, haven't found anything related to my problem.
I have made an app in iOS which lets users download only profile pictures of any Instagram user in HD resolution.
After a long struggle, I have found all of the related API's And I am able to get the HD variant of Profile pictures in the app. Now the thing is those APIs read the phone's browser cookies that if I have authenticated the user in Instagram or not. And if I don't authenticate before the HD profile query id doesn't give me the desired data i.e no HD profile Url.
It means that I can only get the Instagram authentication before letting my users search and query for the HD profile pictures. So I figured out and added that using Instagram Basic Display API.
The problem came when I submitted the app for the Facebook developer review. They keep saying that Instagram profile permission(s) should not be used to authenticate new users in your app.
And it's the 3rd time I told them that the app flow requires the authentication just to read cookies and I am not using any of the user's data for personal authentication, but they are not letting the app pass the review.
My need is can someone help me out if I am really using the wrong authentication process or maybe I am not able to convey my need to the reviewer. So what do I tell them, I am sure there is something going on wrong because I have seen some apps doing the same process in their apps.
Thanks for helping me out

IOS app that displays a Facebook group

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.

Does a user need to be logged in on Facebook to share an open-graph story through Facebook Messenger?

For a user to be able to message an open-graph story via the new Facebook Messenger functionality (messaging an open graph message), does the user need to be logged in to Facebook in my app?
I am talking about the new functionality presented by Facebook at their f8 conference (sending an open graph story to friends through Facebook Messenger).
I'm pretty sure I have everything set up correctly in my mobile app. But the problem is that the other testers (people registered as testers in my app on Facebook) are receiving the open graph story correctly, but when tapping on the open graph story, even though Facebook Messenger redirects to the right app (my app), the FBAppCall object doesn't contain any targetURL information, there is no &target_url=.... ...even though my open graph object has a proper URL set.
That is why I am thinking: Does the user need to also POST the open-graph the story somewhere (thus the user needs to be logged in with Facebook), in order for Facebook Messenger to be able to get the object's URL later?
It seems like this shouldn't be the case, as opening this new functionality of sharing through messenger should be just about getting rid that friction when sharing a story.
does the user need to be logged in to Facebook?
No, he doesn't.
does the user need to be logged in to Facebook in my app?
You must have a valid client token, which means your user must have authorized your app. Just once. Then he can log out from Facebook and/or your app, and you can keep the token on your database and make as many requests as you want, regardless of the user being logged in anywhere.
That means: After the user logs out from facebook, you still get to keep the client token for as long as you want (Well, they do expire: take a look at https://developers.facebook.com/docs/facebook-login/access-tokens/ for more info), and use it to make requests on behalf of the user as you please, using any of the permissions your app was granted by the user (read messages, send messages, post on my behalf, etc.).
In order to share an open graph story through facebook messenger, there must be a story to share published somewhere, of course.
Take on account privacy settings may prevent user/app A from seeing a user/app B story shared by someone else (user/app C) if user/app A didn't have permission to see the original post in the first place (happens when posting with 'only to friends' privacy setting, for example)
The best you can do: debug the responses your app is getting from Facebook. Every time something unusual occurs Facebook will notify you. Are you sure you are not getting any errors/warning messages?

New venue from within ios app?

(EDITED for clarification)
In a nutshell we're trying to allow users to create Foursquare venues in our app but we're having problems.
Detailed problem description:
We're developing an iOS app where our users can create events.
Users register and login with Facebook.
When a user wants to select location for their event they do a text search using Foursquare's API. (Just like when you add a location to your Instagram photo for
example if you're familiar with this).
If the venue exists the user will see it in the list and select it and all is fine.
If however the venue doesn't already exist in Foursquare we've found no way to add it. Compare to Instagram where you
get the option of adding the location directly in-app through
Foursquare's API if the search turns up empty.
Thanks user rckoenes for the API link. We're interpreting the API as it is OK to list venues with "userless access" but in order to make a POST the API "Requires Acting User".
Somehow Instagram seems to manage to allow this without forcing the user to authenticate to Foursquare but we don't see how and we want to avoid having to have this authentication in the app settings(asking them to do this with Facebook is asking enough).
Foursquare API link: https://developer.foursquare.com/overview/auth
I hope this clears things up.
Original post:
If our user can't find the right venue in our app (location search powered by foursquare) how can they create it?
This is possible within Instagram but we haven't found how to replicate it.
Is it possible?
We're developing for iOS.
Thankful for any helpful comments :)
Great question. To answer "how to add venues?", rckoenes was indeed correct when he suggested the venues/add endpoint, but you're right to note that this isn't possible unless there's an actively logged in user.
Just to clarify though, Instagram does not add venues to Foursquare when they allow their users to "Create a custom location." When an Instagram user does this, a "text tag" is associated with their photo and this never gets added to Foursquare, nor is it even searchable on Instagram again (the user would have to re-create it every time they want to use this location). Instagram's UI subtly differentiates this by coloring Foursquare venues as blue and allowing users to see more details on the venue while graying out non-Foursquare venues. The reason that these text tags aren't able to be searched again is that doing so would effectively create your own independent location database, which is a violation of our usage policies.
You can consider Instagram's approach if it's appropriate for your situation, but of course the best solution is to allow your users to authenticate through Foursquare, saving their access tokens, and make venue/add requests on behalf of users themselves. This has recently gotten much easier since the release of Foursquare native auth for iOS.

How to delay asking for Facebook timeline post permission until it's needed, with Omniauth?

For my site, I'm using Omniauth for Facebook authentication, and use Koala to access some misc. data about users.
The site hosts user generated content that's pretty visual, and I used to just use Facebook like button to let people share their content preview to Facebook. However I realized that, due to the nature of the type of content, it's better to post the preview as a photo on their albums (and this is what users want).
However, I don't want to scare away people who just want to try out the service by suggesting them with the permission request to post photos to their timeline when they sign up. Ideally I would want to start out with a default permission with no extended permissions, but let users opt in when they want to share for the first time.
How can I do this? I have read both Omniauth's and Koala's documentations but couldn't find one that describes this particular situation.

Resources