Getting friends of friends with Facebook iOS SDK - iphone

Is it possible to get information about friends of my friends using facebook ios sdk?
Please.If it is possible give an example.
request with Graph api #'[friend_id]/friends" does not work.
'code' [facebook requestWithGraphPath:#"[friend_id]/friends" andDelegate:self];'code'
i try this code but it returns
Error:facebookErrDomain error 10000 where'code'
facebook = [[ Facebook alloc] initWithAppId:app_id];
NSArray *permissions = [NSArray arrayWithObjects:#"I try all permissions"];
[facebook authorize:permissions delegate:self]; 'code'
user is logged in, All information about this friend is available

I'm quite sure this is not possible, you'ld need data access privs of the friends to get their friends data. this has to do with the access rights on fb and this is good for some reasons it is like it is. even if this data protection mechanism disturbs your business idea ;)

If you want catch friend informations you must :
Alloc and Init a Facebook object
Facebook *facebookObject = [[Facebook alloc] init];
Check permissions
NSArray *permissions = [NSArray arrayWithObjects:#"publish_stream", #"offline_access",nil];
Authorize facebook
[facebookObject authorize:APP_ID permissions:permissions delegate:self];
After that you can used
[facebookObject requestWithGraphPath:#"me/friend" andDelegate:self];
In delegate methods
- (void)request:(FBRequest *)request didLoad:(id)result
You catch the result who must be a NSDictionnary.

Related

Getting page_access_token by graph api in FBConnect ios

Actually i want to upload photo on facebook fan page so for this i wrote below code
[m_facebook setAccessToken:#"BAAGgxy3PqqcBAHqByi2JOtTs .....8SCo8MK22y0smcFnxFEt7U6zVP2U4WpLrpnDWNuwXpvSYB9Btt7ZCMljBGmfxgPKoOdmadmNitSZB47trDv9hXd4wAE3VjZBbWBGMPP1lV8H1rfTcXNRuX8ePqRhxXsAypA7uHkSVyZASp0oaVfY0sJF55O8agZDZD"];
[m_facebook requestWithGraphPath:#"437...6356137/photos"
andParams:fbArguments
andHttpMethod:#"POST"
andDelegate:self];
With above code i am able to post photo on my facebook fan page but the problem is i have to hard code Page_Access_Token as you can see so can any one tell me that how i can access this Page_Access_Token token dynamically using FBConnect. I have already went through this link.
You have to authenticate by this line
NSArray *permissions = [[NSArray arrayWithObjects:#"read_stream", #"offline_access", #"publish_stream", #"manage_pages", #"user_photos", #"friends_photos",nil] retain];
[facebook authorize:FB_APP_ID permissions:permissions delegate:self];
Once you get authenticated , you will get AccessToken via this delegate method
- (void)fbDidExtendToken:(NSString*)accessToken expiresAt:(NSDate*)expiresAt
{
//Use access token
}
- (void)fbDidLogin {
[self.facebook1 accessToken];//you can access token once you get this call back.
}
Note: When you call extendAccessToken to extend token, the above delegate will call in that time too. fbDidLogin delegate method call when you get first time authentication. fbDidExtendToken delegate method get call when you try to extend access token. accessToken will get expired depending on expirationDate.

Facebook like button in iPhone native app

I want to implement facebook like button in my native iphone app. So that user can like my facebook page . I am already sharing facebook status updates, but am unable to implement like button.
I was unable to find any helpful resource on web.Please help.
Aaaand here's one I prepared earlier (using FBConnect, the FB api):
If you have the id of the post as postId
NSString *graphPath = [[NSString alloc]
initWithFormat:#"%#/likes",
postId];
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
[[delegate facebook] requestWithGraphPath:graphPath andParams:params andHttpMethod:#"POST" andDelegate:self];
of course you'd need to change how you got the Facebook singleton (I used [delegate Facebook]).

Facebook Connect Posting a Status Update

HI I have got Facebook Connect working with a functional login and logout button. So far thats it, when I press a button a I want to post something to the user. Is there something I have to authorize? What is the precise steps for this. Thank you.
If you want to publish content to User's Feed you not required to authorize user if you use Feed Dialog for any other ways you required to authorize user prior to content publishing.
For web applications/sites (which isn't the case) there is also way to leverage automatic publishing of content user liked using Like Button social plugin by providing correct OpenGraph meta tags.
You really need to read documentation for iOS SDK, especially Dialogs and Authentication and Getting Started Guide.
if you want to set his status thought your FB app without showing a dialog you could do it like this
NSString *message = #"some text";
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:message, message,nil];
[fb requestWithGraphPath:#"me/feed" andParams:params andHttpMethod:#"POST" andDelegate:self]; //fb here is the FaceBook instance.
and for sure you will do that after the user login and authorized the permissions .
To Authorize the permissions
if (![fb isSessionValid]) {
NSArray *permissions = [[NSArray alloc] initWithObjects:#"user_likes", #"read_stream", nil];
[fb authorize:permissions];
[permissions release];
}

Creating a Facebook event on public FB Page using iPhone SDK Graph API

I'm trying to let users create an event on my public Facebook page via an iPhone app, and hopefully let ppl invite their friends to that event.
The idea is that the iPhone app will be able to show the users events from that page, while everyone is able to add the events.
After Authorizing with permissions: create_event and manage_pages, i'm trying to run the following code:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"My Event",#"name",
PAGE_ID, #"page_id",
#"2011-11-10T13:30",#"start_time",
#"2011-11-11T13:30",#"end_time", nil];
[facebook requestWithGraphPath:[NSString stringWithFormat: #"%#/events", PAGE_ID]
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
And I get and error saying: "(#200) Permissions error".
Is it even possible? (creating an event on a page which a user doesn't own)
and if so, what am I missing?
permissions = [[NSArray alloc] initWithObjects:#"offline_access", #"user_events",#"create_event",#"rsvp_event", nil];
I hope that it is just your help.

Where should i put keys given by facebook in FBConnect

I want to use facebook api in my future iphone project..
I have got App id...App Secret...and api key from the facebook..
Now I want to use it in my FBConnect..
Where should I use this details in the fbConnect?
Use the appID to create the facebook object
_facebook = [[Facebook alloc] initWithAppId:kAppId];
decide what permissions you want to get
_permissions = [[NSArray arrayWithObjects:
#"read_stream", #"offline_access",nil] retain];
and then login using
[_facebook authorize:_permissions delegate:self];
also dont forget to add the URL fb[appID] to the URL Types key in the info.plist file.