Search code examples
iphoneobjective-cfacebookios6

can we make this say "Just Now 'AppName' via iOS" in facebook while posting the image


I am working on facebook ios6. when i am posting the image it displays like below image. enter image description here

i want to include my "AppName"

My code is

    -(void)facebookbtnclicked
{
    ACAccountStore *accountStore = [[ACAccountStore alloc] init];
    ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
    ACAccount *account = [[ACAccount alloc] initWithAccountType:accountType];
    NSLog(@"%@, %@", account.username, account.description);
    {
        SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];

        SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
            if (result == SLComposeViewControllerResultCancelled) {

                NSLog(@"Cancelled");
            } else
            {
                NSLog(@"Done");
                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Done" message:@"Image Posted Successfully, Please Create an other Tattoo" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
                UINavigationController *navController=self.navigationController;
                [navController popViewControllerAnimated:YES];
                [alert show];
            }
            [controller dismissViewControllerAnimated:YES completion:Nil];
        };
        controller.completionHandler =myBlock;
        [controller setInitialText:self.textMsg];
        [controller addImage:appDelegate.shareImage];//This image i am posting
        [self presentViewController:controller animated:YES completion:Nil];
    }
}

Give me any suggestions


Solution

  • If you use native sharing dialog, you cannot change it.

    Old method of posting photo:

    NSDictionary *param = [NSDictionary dictionaryWithObjectsAndKeys:[UIImage imageNamed:@"YOURIMAGE.png"], @"picture", nil];
    [FBRequestConnection startWithGraphPath:@"me/feed"
        parameters:param
        HTTPMethod:@"POST"
        completionHandler:^(FBRequestConnection *connection,
                            id result,
                            NSError *error) 
    {
        if (error) 
            NSLog(@"failed");
        else 
            NSLog(@"posted");
    }];