我的应用程序以下列方式发送推文:
-(IBAction)TweetMethod:(id)sender{
tweetView = [[TWTweetComposeViewController alloc] init];
TWTweetComposeViewControllerCompletionHandler
completionHandler = ^(TWTweetComposeViewControllerResult result)
{
switch (result)
{
case TWTweetComposeViewControllerResultCancelled:
NSLog(@"Twitter Result: canceled");
break;
case TWTweetComposeViewControllerResultDone:
NSLog(@"Twitter Result: sent");
break;
default:
NSLog(@"Twitter Result: default"); break;
}
[self dismissModalViewControllerAnimated:YES]; };
[tweetView setCompletionHandler:completionHandler];
NSURL *url = [[NSURL alloc] initWithString:@"Twitter.com"];
UIButton *button = (UIButton*) sender;
for (UITextView *text in messagetext)
{
for (UITextView *name in messagename)
{
if ([text isKindOfClass:[UITextView class]] && text.tag == button.tag && text.tag== name.tag)
{
[tweetView setInitialText:[NSString stringWithFormat:@"Event name: %@. Download the app to check out the full details, including location, at: ", name.text]];
}
}
}
[tweetView addImage:[UIImage imageNamed:@"smallIcon 144 ipad.png"]];
[tweetView addURL:url];
[self presentModalViewController:tweetView animated:YES];
}
我注意到,如果我保留这条线:
[tweetView addImage:[UIImage imageNamed:@"smallIcon 144 ipad.png"]];
出现图像,但蓝色按钮推文已关闭,因此我无法推文,而如果我删除该行,则没有图像,我可以推文。为什么??