How to integrate Facebook in iOS 6 using SLRequest?

I've been looking around trying to figure out how to integrate Facebook in iOS6 using SLRequests. I was able to do it after some research. Here's some code snippet that show how it's done.

    ACAccountStore *accountStore = [[ACAccountStore alloc] init];
    __block ACAccount *facebookAccount = nil;

    ACAccountType *facebookAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];

    // Specify App ID and permissions
    NSDictionary *options = @{
    ACFacebookAppIdKey: @"012345678912345",
    ACFacebookPermissionsKey: @[@"publish_stream", @"publish_actions"],
    ACFacebookAudienceKey: ACFacebookAudienceFriends

    [accountStore requestAccessToAccountsWithType:facebookAccountType
        options:options completion:^(BOOL granted, NSError *e) 
            if (granted)
                NSArray *accounts = [accountStore accountsWithAccountType:facebookAccountType];

                facebookAccount = [accounts lastObject];
              // Handle Failure

    NSDictionary *parameters = @{@"message": @"My first iOS 6 Facebook posting "};

    NSURL *feedURL = [NSURL URLWithString:@""];

    SLRequest *feedRequest = [SLRequest 

    feedRequest.account = facebookAccount;

    [feedRequest performRequestWithHandler:^(NSData *responseData, 
                                             NSHTTPURLResponse *urlResponse, NSError *error)
         // Handle response

I hope this helps someone.


I have a write up on how to use SLRequest.

    // Create the URL to the end point
    NSURL *postURL = [NSURL URLWithString:@""];

    NSString *link = @"";
    NSString *message = @"Testing Social Framework";
    NSString *picture = @"";
    NSString *name = @"Social Framework";
    NSString *caption = @"Reference Documentation";
    NSString *description = @"The Social framework lets you integrate your app with supported social networking services. On iOS and OS X, this framework provides a template for creating HTTP requests. On iOS only, the Social framework provides a generalized interface for posting requests on behalf of the user.";

    NSDictionary *postDict = @{
    @"link": link,
    @"message" : message,
    @"picture" : picture,
    @"name" : name,
    @"caption" : caption,
    @"description" : description

    SLRequest *postToMyWall = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodPOST URL:postURL parameters:postDict];

    FacebookAccountManager* sharedManager = [FacebookAccountManager sharedAccount];
    [postToMyWall setAccount:sharedManager.facebookAccount];

    [postToMyWall performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
        if (error) {
            // If there is an error we populate the error string with error
            _errorString = [NSString stringWithFormat:@"%@", [error localizedDescription]];

            // We then perform the UI update on the main thread. All UI updates must be completed on the main thread.
            [self performSelectorOnMainThread:@selector(updateErrorString) withObject:nil waitUntilDone:NO];

            NSLog(@"Post successful");
            NSString *dataString = [[NSString alloc] initWithData:responseData encoding:NSStringEncodingConversionAllowLossy];
            NSLog(@"Response Data: %@", dataString);

Full post and app download available here:

Need Your Help

C interpreter written in javascript

javascript c gwt interpreter

Is there any C interpreter written in javascript or java ?

How can I plot my R Squared value on my scatterplot using R?

r plot statistics linear-regression

This seems a simple question, so I hope its a simple answer. I am plotting my points and fitting a linear model, which I can do OK. I then want to plot some summary statistics, for example the R Sq...