JasonQ
JasonQ

Reputation:

Submitting a link via iPhone -> Facebook Connect

I'm trying to post links through the iPhone facebook connect without using the feed control. I want to simulate how the publish a story works on facebooks website, where I pass a link, and it returns back an image, story title, and a link. Right now I only know how to use the feed control, but I'm thinking there has to be a way to use possibly stream.Publish or showDialog, just not really sure which..

Anyone have any experience with this?

Upvotes: 2

Views: 4391

Answers (1)

Corey Floyd
Corey Floyd

Reputation: 25969

Use the facebook demo app.

in the SessionViewController, add this to get extended permission:

- (void)askPermission:(id)target {
  FBPermissionDialog* dialog = [[[FBPermissionDialog alloc] init] autorelease];
  dialog.delegate = self;
  dialog.permission = @"publish_stream";
  [dialog show];
}

Then you need a method to publish the stream. They don't say exactly what data to send. But whateer it is you package it in a dictionary. Since it is a URL, a good guess would be an NSString. You can get more from the API page

I found 5 that might work:

Feed.publishActionOfUser Feed.publishStoryToUser Feed.publishTemplatizedAction Feed.publishUserAction

Also there is:

Links.post

But you'll have to figure it out, depending on what you want to do. You also need to kow the key. I picked url

- (IBAction)sendURL:(id)target{

    NSMutableDictionary *args = [[[NSMutableDictionary alloc] init] autorelease];
    [args setObject:urlString forKey:@"url"];  
    FBRequest *uploadPhotoRequest = [FBRequest requestWithDelegate:self];
    [uploadPhotoRequest call:@"Links.post" params:args];
}

I've left some args out, but you get the idea. I;m not sure exactly what one you want, so you'll have to research the method calls.

Hope this helps.

Upvotes: 2

Related Questions