I have a UITextField that the user will enter a cell phone number.The user touches a IBAction button and it is passed to the MFMessageComposeViewController sms recipients.it seems that the recipients will not alow a NSString to be used.Passing a NSString to the body works but not the recipients.
-(IBAction)buttonSMS: (id)sender
{
if([MFMessageComposeViewController canSendText])
{
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.recipients=[NSArray arrayWithObjects:@"15557774444", nil];
picker.body = textField.text;
picker.messageComposeDelegate = self;
[self presentViewController:picker animated:YES completion:NULL];
}
}
this is what i tried
picker.recipients = telField.text;
in place of
picker.recipients=[NSArray arrayWithObjects:@"15557774444", nil];
Can some one point me in the rite direction with some sample code…..please and thankyou
Expert in all things html,javascript and css but newbee in objective c
The
recipientsproperty is of typeNSArray *. A string is not. You must wrap the string in an array, like so:[NSArray arrayWithObject:telField.text].