Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Settings button of iOS Facebook SDK 3.1 not working

I have done all steps that are explained here: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/3.1/

I have tested the demo projects and fail the same as on my project. (you can test it on HelloFacebookSample project).

When you don't have any Facebook account configured, you can't share something on facebook, or upload an image etc, (the same as twitter framework). So the frameworks shows you a message that tells this:

There are no Facebook accounts configured. You can add or create a Facebook account in Settings.

You click on settings but the only thing that happends is that this dialog is hided, but the framework doesn't open the Settings tab (as work on for example on the twitter framework).

Does anyone know how to solve this problem?

Thanks in advance.

like image 306
Miguel Avatar asked Oct 08 '12 12:10

Miguel


1 Answers

Please use SLComposeViewController class for Facebook sharing, setting button work for you.

if([SLComposeViewController class])
{
    SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
    [controller setInitialText:text];
    [controller addURL:[NSURL URLWithString:encod]];
    [self presentViewController:controller animated:YES completion:Nil];
    //[message release];

    SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result)
    {
        NSString *output= nil;
        switch (result)
        {
            case SLComposeViewControllerResultCancelled:
                output= @"Action Cancelled";
                break;
            case SLComposeViewControllerResultDone:
                output= @"Post Succesfull";
                [self displayText:@"done"];
                break;
            default:
                break;
        }

     };
    controller.completionHandler =myBlock;
}

This code is working for me

like image 176
Nikunj Patel Avatar answered Oct 22 '22 15:10

Nikunj Patel