I have a button that shares twitter message. The problem is social network does not work on iOS 5.1 so my question is how do I send an error message if the user is using iOS 5.1?
-(IBAction)Twitter:(id)sender{
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
if (result == SLComposeViewControllerResultCancelled) {
NSLog(@"Cancelled");
} else
{
NSLog(@"Done");
}
[controller dismissViewControllerAnimated:YES completion:Nil];
};
controller.completionHandler =myBlock;
[controller setInitialText:@"#VOX"];
[controller addURL:[NSURL URLWithString:@""]];
[controller addImage:[UIImage imageNamed:@""]];
[self presentViewController:controller animated:YES completion:Nil];
}
else{
alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please check your Twitter settings." delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:nil ,nil];
[alert show];
}
}
This is my code.