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 8921543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:34:22+00:00 2026-06-15T06:34:22+00:00

I have a project that uses the Twitter API to Tweet the users high

  • 0

I have a project that uses the Twitter API to Tweet the users high score. That project is written using Cocos2d v1.1 and everything is working fine. I recently started a new project using Cocos2d v2.0 and attempted to use the same code from my other project to incorporate the same Twitter functionality but the viewcontroller will not appear when the Tweet button is pressed. Below is the code I’m using…

if ([TWTweetComposeViewController canSendTweet]) // Check if twitter is setup and reachable
    {
        CCLOG(@"Can Tweet");
        TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];

        // set initial text
        NSString *theTweet = @"The message..."];
        [tweetViewController setInitialText:theTweet];

        // setup completion handler
        tweetViewController.completionHandler = ^(TWTweetComposeViewControllerResult result) {
            if(result == TWTweetComposeViewControllerResultDone) {
                // the user finished composing a tweet

            } else if(result == TWTweetComposeViewControllerResultCancelled) {
                 // the user cancelled composing a tweet
            }
            [viewController dismissViewControllerAnimated:YES completion:nil];
        };

        // present view controller
        [[[CCDirector sharedDirector] openGLView] addSubview:viewController.view];
        [viewController presentViewController:tweetViewController animated:YES completion:nil];

    }
else
{
    // Twitter account not configured, inform the user
    NSLog(@"You can't send a tweet right now, make sure your device has an internet connection and you have at least one Twitter account setup");
}

I’ve discovered that “openGLView” is now depreciated and I have replaced it with “view”. This still does not work. The method is firing though. I’ve included a CCLOG that return the string “Can Tweet” and that is appearing in the output window. Does anyone have any suggestions on how to get this to work. Let me know if I need to provide more information.

Thanks

  • 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-15T06:34:24+00:00Added an answer on June 15, 2026 at 6:34 am

    Use this code in cocos2d 2.0

    AppController * app = (((AppController*) [UIApplication sharedApplication].delegate));
    
            TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];
    
            [tweetViewController setInitialText:string];
    
            [tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result) {
    
                dispatch_async(dispatch_get_main_queue(), ^{
    
                    {
                        if (result == TWTweetComposeViewControllerResultDone)
                        {
                            //successful
                            [[NSNotificationCenter defaultCenter] postNotificationName:@"PPTweetSuccessful" object:nil];
    
                        }
                        else if(result == TWTweetComposeViewControllerResultCancelled)
                        {
                            //Cancelled
                        }
                    }
    
                    [app.navController dismissModalViewControllerAnimated:YES];
    
                    [tweetViewController release];
                });
    
            }];
    
            [app.navController presentModalViewController:tweetViewController animated:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project that uses Serve and is version controlled using Git. Serve
I have a project that uses System.Runtime.Serialization assembly. I am using the type DataContractSerializer
i have a project that uses myBatis for persistence. method A below was working
I have a project that uses a Java library converted using IKVM . I
I have a project that uses a UITabBarController for navigation. When users navigate to
I have a Flex application that uses the Last.fm and Twitter api. After I
I have a project that I'm working that uses XSLT to display data from
I have a project that uses a few 3rd party DLLs, and am working
I have a project that uses a DLL that I have created. Everything works
I have a project that uses SystemConfiguration.Framework. I've been using xcode, where adding the

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.