I have the coredata showing in text fields the data stored
in view didload: tfEmail.text = editEmp.email;
the message composer works as well, but if I want to use the email data to include in my message, I get the trouble...
NSArray *toRecipients = [NSArray arrayWithObject:@"employee@example.com"]; [picker setToRecipients:toRecipients];
what I need to do is to include the tfEmail in the NSArray, so if I try
NSArray *toRecipients = [NSArray arrayWithObject:@"%@", tfEmail.text];
I will get an error
Too many arguments to function arrayWithObje开发者_运维问答ct
How do I fix this?
You are tryig to pass a string to the array initializer but are actually passing in two strings. This line should be changed:
NSArray *toRecipients = [NSArray arrayWithObject:@"%@", tfEmail.text];
You are passing in two string objects, @"%@"
and tfEmail.text
. Try removing the format string, like so:
NSArray *toRecipients = [NSArray arrayWithObject:tfEmail.text];
If you wanted to keep the format, wrap those strings as follows:
NSArray *toRecipients = [NSArray arrayWithObject:[NSString stringWithFormat:@"%@", tfEmail.text]];
精彩评论