I created in my Xcode project an form that has 2 text fields in which does the user insert his current address and destination . And when I click on the Send return key in the second text field , the message compose controller appears well .
But, the problem is that the body of the message isn’t “dragging” the value from text field and the message . So I want the value from my text fields have in the message body .
Where is the problem ?
-(IBAction)btnSendSms:(id)sender {
[sender resignFirstResponder];
[[UIApplication sharedApplication ] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
if ([MFMessageComposeViewController canSendText]) {
controller.body = @"My body text %@: " , textField1.text , textField2.text;
controller.recipients = [NSArray arrayWithObjects:@"011888",nil];
controller.messageComposeDelegate = self;
controller.navigationBar.tintColor = [UIColor blackColor];
[self presentModalViewController:controller animated:YES];
you should correct the body String: