Joe Fratianni
Joe Fratianni

Reputation: 790

Posting from my app in Facebook

I would like to update my iOS app to take advantage of iOS 6 Facebook integration. Currently I use the Facebook dialogue. I like the way I can present the dialogue to the user and when it posts it has my app icon and the small tag saying "via my app name" which links to my app.

With the iOS 6 Facebook integration it says "via iOS" and a link to Apple's Website. Is there a way to achieve the same type of result using iOS 6's Facebook integration?

current code:

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"1234567890", @"app_id",
                               @"http://www.mywebsite.com/page5/page5.html", @"link",
                               picLink, @"picture",
                               countDownName, @"name",
                               @"My app name", @"caption",
                               @"For the iPhone and iPod Touch", @"description",
                               theMessage, @"message",
                               theFriendID, @"to",
                               @"Share on Facebook",  @"user_message_prompt",
                               nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];

my iOS 6 code (taken from Facebook's sample code)

    BOOL displayedNativeDialog = [FBNativeDialogs presentShareDialogModallyFrom:self
                                                                initialText:initialText
                                                                      image: [UIImage imageNamed: @"myImage.png"]
                                                                        url:url
                                                                    handler:nil];
if (!displayedNativeDialog) {

    [self performPublishAction:^{
        // otherwise fall back on a request for permissions and a direct post
        [FBRequestConnection startForPostStatusUpdate:message
                                    completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

                                        [self showAlert:message result:result error:error];
                                        self.buttonPostStatus.enabled = YES;
                                    }];

        self.buttonPostStatus.enabled = NO;
    }];

Upvotes: 4

Views: 1512

Answers (2)

Paramasivan Samuttiram
Paramasivan Samuttiram

Reputation: 3738

Please try using custom Facebook compose view provided here.

Upvotes: 0

Pedro Vieira
Pedro Vieira

Reputation: 3370

A quick google search showed the following tutorial: http://www.techotopia.com/index.php/IPhone_iOS_6_Facebook_and_Twitter_Integration_using_SLRequest#Facebook_Integration_using_SLRequest
That seems to be a good tutorial to do what you're looking for.

Upvotes: 1

Related Questions