Note that there are some explanatory texts on larger screens.

plurals
  1. POCalling variables into in-app email with
    primarykey
    data
    text
    <p>Hey everyone, what I'm trying to do is grab variables from textfields on my interface and use them in a email triggerd by a button directly beneath those buttons. I followed a tutorial to show me how to do this, formatting using a .html file and i've not been able to actually substitute those placeholders in the file! If someone could please tell me what I'm doing wrong, or what would work that would be appreciated!</p> <p>Here is the code from the implementation file in the method of clicking the email button</p> <pre><code>- (IBAction)email:(id)sender { MFMailComposeViewController *compose = [[MFMailComposeViewController alloc] init]; compose.mailComposeDelegate = self; [compose setSubject:@"Float Plan for my Boat Trip"]; [compose setCcRecipients:[NSArray arrayWithObject:@"towboat911@gmail.com"]]; NSUserDefaults *person = [NSUserDefaults standardUserDefaults]; [person setObject:personField.text forKey:@"person"]; NSUserDefaults *pob = [NSUserDefaults standardUserDefaults]; [pob setObject:pobField.text forKey:@"pob"]; NSUserDefaults *phone = [NSUserDefaults standardUserDefaults]; [phone setObject:phoneField.text forKey:@"phone"]; NSUserDefaults *medical = [NSUserDefaults standardUserDefaults]; [medical setObject:medicalField.text forKey:@"medical"]; NSUserDefaults *depart = [NSUserDefaults standardUserDefaults]; [depart setObject:departField.text forKey:@"depart"]; NSUserDefaults *left = [NSUserDefaults standardUserDefaults]; [left setObject:leftField.text forKey:@"left"]; NSUserDefaults *arrive = [NSUserDefaults standardUserDefaults]; [arrive setObject:arriveField.text forKey:@"arrive"]; NSUserDefaults *destination = [NSUserDefaults standardUserDefaults]; [destination setObject:destinationField.text forKey:@"destination"]; NSString *emailFileName = [NSString stringWithFormat:@"email_en_US.html"]; NSString *emailFilePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: emailFileName]; NSString *body = [NSString stringWithContentsOfFile:emailFilePath encoding:NSUTF8StringEncoding error:nil]; body = [body stringByReplacingOccurrencesOfString:@"//PERSON//" withString:@"person"]; body = [body stringByReplacingOccurrencesOfString:@"//PERSONSIGN//" withString:@"person"]; body = [body stringByReplacingOccurrencesOfString:@"//POB//" withString:@"pob"]; body = [body stringByReplacingOccurrencesOfString:@"//PHONE//" withString:@"phone"]; body = [body stringByReplacingOccurrencesOfString:@"//MEDICAL//" withString:@"medical"]; body = [body stringByReplacingOccurrencesOfString:@"//DEPART//" withString:@"depart"]; body = [body stringByReplacingOccurrencesOfString:@"//LEFT//" withString:@"left"]; body = [body stringByReplacingOccurrencesOfString:@"//ARRIVAL//" withString:@"arrive"]; body = [body stringByReplacingOccurrencesOfString:@"//DESTINATION//" withString:@"destination"]; NSString *emailBody = [NSString stringWithFormat:body]; [compose setMessageBody:emailBody isHTML:YES]; compose.navigationBar.barStyle = UIBarStyleBlack; [self presentModalViewController:compose animated:YES]; [compose release]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload