我一直在使用此代码发布推特。
SLComposeViewController *fbController=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){
[fbController dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
NSLog(@"Cancelled.....");
}
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Posted....");
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Success"
message:@"Posted Successfully"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
break;
}};
[fbController addImage:[UIImage imageNamed:@"1.jpg"]];
[fbController setInitialText:@"Check out this article."];
//[fbController addURL:[NSURL URLWithString:@"http://soulwithmobiletechnology.blogspot.com/"]];
[fbController setCompletionHandler:completionHandler];
[self presentViewController:fbController animated:YES completion:nil];
}
如果用户没有设置 twitter 帐户,它会显示具有设置和取消按钮的警报。但它没有在设备中显示警报?任何人都可以帮助我吗?提前致谢 。