0
我收到尝试使用下面的代码发布到Twitter的图像时这个错误,不能认为我是什么如何解决错误的想法?警告:试图提出<SLTwitterComposeViewController:0x233141c0>在<MainController:0x2083ebb0>谁的观点是不是在窗口层次
- (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];
}
我那个'app.mainCtrl'视图控制器是不是在你努力表现Twitter的控制器时显示。 – rmaddy
@rmaddy,加上一个好的答案,虽然在注释的形式。 –