i'm having a problem with my MFMessageComposeController. So, in my app every time you click on a button, a UIActionSheet appears and then you have to select if you want to make a call or send a message . But every time that i make a call, end it and return to my app, my MFMessageComposeController appears... where could the problem be ? here is the code if it helps
case 0 : {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"tel://011212"]];
[actionSheet dismissWithClickedButtonIndex:0 animated:NO];
}
case 1: {
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackOpaque];
}
[[UIApplication sharedApplication ] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
MFMessageComposeViewController*controller =[[[MFMessageComposeViewController alloc] init] autorelease];
if ([MFMessageComposeViewController canSendText]) {
controller.body = [NSString stringWithFormat:@"Narucio bih Oryx Taxi na lokaciju ( %@ , %@ ) .\nNaruci! aplikacija", latitudePoint.text, longitudePoint.text];
controller.recipients = [NSArray arrayWithObjects:@"011888",nil];
//controller.messageComposeDelegate = self;
controller.messageComposeDelegate=self;
controller.navigationBar.tintColor = [UIColor grayColor];
[self presentModalViewController:controller animated:YES];
You need to add a break after each case in your switch statement. Otherwise execution will fall through to the next case.
case 0 : {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"tel://011212"]];
[actionSheet dismissWithClickedButtonIndex:0 animated:NO];
break;
}
case 1: {
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackOpaque];
break;
}