Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9038083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:24:15+00:00 2026-06-16T09:24:15+00:00

i want to share a post on facebook it works fine when i use

  • 0

i want to share a post on facebook it works fine when i use iOS 6 but in iOS 5 and iOS 5.1 it gives an issue of login, when i login and goes to already authorised page and press okay button it pulls me back to login like this and repeats again and again on these two pages
enter image description here

when i press okay it gives back

enter image description here

 case 1: // facebook
        {
            if(NSClassFromString(@"SLComposeViewController"))
            {
                SLComposeViewController *fbController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
                SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){

                    [fbController dismissViewControllerAnimated:YES completion:nil];

                    switch(result){
                        case SLComposeViewControllerResultCancelled:
                        default:
                        {
                            NSLog(@"Cancelled.....");

                        }
                            break;
                        case SLComposeViewControllerResultDone:
                        {
                            ALERT_VIEW(@"Successfully posted to facebook.");
                        }
                            break;
                    }};

                [fbController setInitialText:quotesss];
                [fbController setCompletionHandler:completionHandler];
                [self presentViewController:fbController animated:YES completion:nil];
            }
            else
            {
                DEFacebookComposeViewControllerCompletionHandler completionHandler = ^(DEFacebookComposeViewControllerResult result) {
                    switch (result) {
                        case DEFacebookComposeViewControllerResultCancelled:
                            NSLog(@"Facebook Result: Cancelled");
                            break;
                        case DEFacebookComposeViewControllerResultDone:
                            ALERT_VIEW(@"Successfully posted to facebook.");
                            break;
                    }

                    [self dismissViewControllerAnimated:YES completion:nil];
                };
                DEFacebookComposeViewController *facebookViewComposer = [[DEFacebookComposeViewController alloc] init];
                self.modalPresentationStyle = UIModalPresentationCurrentContext;

                [facebookViewComposer setInitialText:quotesss];

                facebookViewComposer.completionHandler = completionHandler;
                [self presentViewController:facebookViewComposer animated:YES completion:nil];
                [facebookViewComposer release];
            }
            break;
        }
        case 2: // twitter
        {
            NSString *text = [NSString stringWithFormat:@"%@", quotesss ];
            if([text length] > 135)
            {
                text = [NSString stringWithFormat:@"%@%@", quotesss ,@"..."];
                text = [text substringToIndex:135];

            }

            if(NSClassFromString(@"SLComposeViewController"))
            {
                SLComposeViewController *twitterController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
                SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){

                    [twitterController dismissViewControllerAnimated:YES completion:nil];

                    switch(result){
                        case SLComposeViewControllerResultCancelled:
                        default:
                        {
                            NSLog(@"Cancelled.....");

                        }
                            break;
                        case SLComposeViewControllerResultDone:
                        {
                            ALERT_VIEW(@"Successfully posted to twitter.");
                        }
                            break;
                      }};

                [twitterController setInitialText:text];
                [twitterController setCompletionHandler:completionHandler];
                [self presentViewController:twitterController animated:YES completion:nil];
            }

            else
            {
                DETweetComposeViewControllerCompletionHandler completionHandler = ^(DETweetComposeViewControllerResult result) {
                    switch (result) {
                        case DETweetComposeViewControllerResultCancelled:
                            NSLog(@"Twitter Result: Cancelled");
                            break;
                        case DETweetComposeViewControllerResultDone:

                            ALERT_VIEW(@"Successfully posted to twitter.");
                            break;
                    }
                    [self dismissViewControllerAnimated:YES completion:nil];
                 };

                DETweetComposeViewController *tcvc = [[[DETweetComposeViewController alloc] init] autorelease];
                self.modalPresentationStyle = UIModalPresentationCurrentContext;
                [tcvc setInitialText:quotesss];
                tcvc.completionHandler = completionHandler;

                [self presentViewController:tcvc animated:YES completion:nil];

            }

            break;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:24:16+00:00Added an answer on June 16, 2026 at 9:24 am

    From your code i found that the problem is in this code coz in iOS 5 Facebook is not available in SLCompose only Twitter is available so your FaceBook is handling by DEFaceBook

                DEFacebookComposeViewControllerCompletionHandler completionHandler = ^(DEFacebookComposeViewControllerResult result) {
                    switch (result) {
                        case DEFacebookComposeViewControllerResultCancelled:
                            NSLog(@"Facebook Result: Cancelled");
                            break;
                        case DEFacebookComposeViewControllerResultDone:
                            ALERT_VIEW(@"Successfully posted to facebook.");
                            break;
                    }
    
                    [self dismissViewControllerAnimated:YES completion:nil];
                };
                DEFacebookComposeViewController *facebookViewComposer = [[DEFacebookComposeViewController alloc] init];
                self.modalPresentationStyle = UIModalPresentationCurrentContext;
    
                [facebookViewComposer setInitialText:quotesss];
    
                facebookViewComposer.completionHandler = completionHandler;
                [self presentViewController:facebookViewComposer animated:YES completion:nil];
                [facebookViewComposer release];
            }
    

    So go to your appdelegate and check this method that a valid token(url which contains your application, token format is applicationURLSchema://"token") check it is coming or not in this method
    If necessary keep break point and go through the FBSession class then handleOpenURL method and find where error is happening

     - (BOOL)application:(UIApplication *)application  openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication
     annotation:(id)annotation {
    
     // attempt to extract a token from the url
     return [FBSession.activeSession handleOpenURL:url];
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application I want post a text message in facebook wall streemPublish but
I've used the iOS Facebook SDK before to post to one's timeline or share
I want to share a link using Facebook Graph API. I am doing following.
I want my application to post something on Facebook wall. My application is supposed
I upgraded my game to use the facebook SDK 3.1 and it works for
I have a wordpress blog.I Want to add Facebook like Button &Facebook Share button
I'm having a problem now with Facebook share button. The url i use for
I want to get stats (likes, comments, shares) of a Facebook post. How can
I want to post something in the users friends wall. I use this to
I want to be able to share videos from my Wordpress site to Facebook

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.