0

我在尝试使用以下代码将图像发布到 Twitter 时收到此错误,想不出我在做什么错任何关于如何解决的想法?

- (void)PostToTwitter

    {   
        UIImage* pxImage = [[self GetResultImage] retain];

        TWTweetComposeViewController *twitter = [[[TWTweetComposeViewController alloc] init] autorelease];

        [twitter setInitialText:@"Twitter Pic"];
        [twitter addImage:pxImage];

        FaceAppDelegate* app = (FaceAppDelegate*)[[UIApplication sharedApplication] delegate];
        [app.mainCtrl presentViewController:twitter animated:YES completion:NULL];

        twitter.completionHandler = ^(TWTweetComposeViewControllerResult res)
        {
            if(res == TWTweetComposeViewControllerResultDone)
            {
                UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Success" message:@"You have posted successfully." delegate:self cancelButtonTitle:@"Close" otherButtonTitles: nil];
                [alert show];
                [alert release];
            }
            else if(res == TWTweetComposeViewControllerResultCancelled)
            {
                UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Cancelled" message:@"You have cancelled posting to Twitter." delegate:NULL cancelButtonTitle:@"Close" otherButtonTitles: nil];
                [alert show];
                [alert release];
            }
            [app.mainCtrl dismissModalViewControllerAnimated:YES];
        };

        [pxImage release];

    }
4

1 回答 1

0

我认为,没有提出您的观点。尝试使用 app.window.rootViewController,而不是属性 mainContr。

于 2013-07-21T20:00:08.733 回答