2012-10-06 22 views
0

我有一個UITextField,用戶將輸入一個手機號碼。用戶觸摸一個IBAction按鈕,它傳遞給MFMessageComposeViewController SMS收件人。似乎收件人將不會讓一個NSString被使用。將NSString傳遞給身體工作,但不是收件人。UITextField SMS配方

-(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]; 
    } 

} 

這就是我試圖

picker.recipients = telField.text; 

代替

picker.recipients=[NSArray arrayWithObjects:@"15557774444", nil]; 

有人能指出我的一些示例代碼儀式方向.....請與三江源

專家在所有的東西HTML,JavaScript和CSS,但新客戶在目標C

回答

0

recipients屬性類型NSArray *。一個字符串不是。您必須將字符串包裝在數組中,如下所示:[NSArray arrayWithObject:telField.text]

+0

謝謝你這麼多喬納森,這工作完美........ Len – user1725650