need help to get Facebook profile picture. Also is GRAPH Api online test site down? - objective-c

I followed the instructions from github.com/facebook/facebook-ios-sdk
and can get Facebook login dialog and get connected. It's for ipad application to get FB info. user name, friend list can be fetched correctly.
I tried to get the profile picture
[_facebook requestWithGraphPath:#"me/picture" andDelegate:self];
and received response:There was a problem communicating with server...
but similar calls like
[_facebook requestWithGraphPath:#"me/posts" andDelegate:self];
[_facebook requestWithGraphPath:#"me/friends" andDelegate:self];
work just fine.
also tried the facebook graph API online test site:
https://developers.facebook.com/tools/explorer/
to use it, first get access token, then tried to get posts, friends, and they are fine.
but when to get picture will take forever, and never return anything.
I did log into my facebook account in a web browser and the profile picture appears just fine.

The Graph API for the user endpoint is described here:
http://developers.facebook.com/docs/reference/api/user/
About the picture connection, it says:
HTTP 302 redirect to URL of the user's profile picture (use ?type=square | small | normal | large to request a different photo).
So what you get is not the typical JSON response, but the picture itself (via the HTTP redirect). You can try that by entering the graph API call into your browser location bar. For example, to see the profile pic of Mark Zuckerberg, try:
http://graph.facebook.com/markzuckerberg/picture

Related

Firebase's Google Authentication User Object returns profile path with 404 response

Am using Firebase Google Authentication in my App. If the user does not have a profile image, Google used to return a dynamic picture, made up from the user's first or last initial, or digraph where applicable, all depending on each person's name structure.
Eg : If the user name is Jack and he does not have profile picture the
URL will return this image.
But Past few weeks the Url Returned by the method
FirebaseAuth.getInstance().getCurrentUser().getPhotoUrl(); is a 404
page.
Because of this am getting Exceptions in Glide app. I need an image as above as my App is a conversation app, Which will help users to identify easily if they dont have a profile image. Please let me know if google changed the way accessing the image or it stopped permanently. Also provide me any alternatives to get this above image.

Can we authenticate facebook user which view page in UIWebView?

I work on application which provide bonus content for certain actions Facebook Share, Facebook Like of our page and etc.
I have problem with Facebook Like, as we know Facebook SDK ToS don't allow us (developers) to programmatically like Facebook page, so I have two ideas
Open the native Facebook APP, which is straight forward.
UIWebView within' our APP. But here is the problem
How to authenticate the user in facebook, to skip the inconvenience of double login. (The first time is within' our app, to be able to fetch the result of /me/likes/(id))?
I also faced the same problem for liking pages
i found this
https://github.com/brow/FacebookLikeView it is very help full go through this it shows how to like face book pages by using web view
hope this helps

Request ID is not available when App Launches after clicking Facebook notification

A Facebook app is setup with iOS native app enabled with bundle id and App Store Id of another app.
Following are possible in the current scenario.
1.Sending an app request to a friend,
2.The request badge appears in the friend's Facebook,
3. And clicking on the request launches my app.
This was the link i referred to implement this.
https://developers.facebook.com/docs/howtos/send-requests-using-ios-sdk/#protip3
I am supposed to get a NSURL from these functions
– application:openURL:sourceApplication:annotation:
OR
– application:handleOpenURL:
and the expected format is as follows.
fb[APP_ID]://authorize#expires_in=[ACCESS_TOKEN_EXPIRATION]
&access_token=[USER_ACCESS_TOKEN]
&target_url=https://apps.facebook.com/[APP_NAME_SPACE]/?request_ids=
[COMMA_SEPARATED_REQUESTIDs]&ref=notif&app_request_type=user_to_user
Here the request_ids contains The id of app request send, and which can be used to get the data attached to the App Request.
Now my issue is that, I am not getting the NSURL in expected form, instead I get the following format. So I am unable to find or use the request_ids.
fb[APP_ID]://authorize#expires_in=[ACCESS_TOKEN_EXPIRATION]
&access_token=[USER_ACCESS_TOKEN]
&target_url=https://apps.facebook.com/application.php?id=442634372448098

Facebook App request in iOS (not using Dialog)

I need to send a request throw my app to user's friends in Facebook (After the app on Facebook is authorized) I know there is a way to do it through the SDK :
[self.facebook dialog:#"apprequests" andParams:params andDelegate:nil];
But I don't need that way to show the dialog I just need to be able to send the request in the background when the user select the friend from (Table View for example).
Is this possible?
The Facebook Dialog API has not been updated (yet, hopefully). You can't bypass the dialog the way you want to do it.
But, you can :
preselect the friends with your own GUI and gives the apprequest the selected facebook ids. This way, the dialog is just to confirm the request.
activate the frictionless parameter, to avoid the dialog the next time you send the request for the same selected friends (the confirm dialog seems to show anyway, though, and immediately disappear, it gives a not-so-nice blink on the screen).
here's the related documentation, in case you need it : https://developers.facebook.com/docs/howtos/send-requests-using-ios-sdk/

Facebook invitation request is not delivered

I am showing a dialog in an iOS app to allow users to select some friends to whom send an invitation to the app.
The dialog is displayed, you can select some friends and press send.
Dialog delegate method callback is called successfuly.
So far so good, but the friend is not receiving any invitation,
is that because the app is still in development?
This is the code I am using to show the dialog, is there any missing parameter?
(access token is fine because the app works).
// Show the UI Dialog
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kFacebookAppID,#"access_token", #"Invitation message", #"message",nil];
[facebook dialog:#"apprequests"andParams:params andDelegate:self];
Requests are only delivered if the user can reasonably be expected to accept them; if your app is only an iOS app (i.e no canvas implementation / apps.facebook.com URL) then they'll only be displayed in the Facebook app for iOS.
If this isn't happening it may be because your SSO settings for the app aren't correct, so Facebook's app doesn't know how to bring users to your app when they accept the request, check those first - making sure the URL handler is set up correctly in your app, etc.
It may also be because the app is in sandbox mode, but i'm not sure about that one.