我正在嘗試製作iPhone應用程序,用戶可以使用內置模板發送短信。例如:如何根據iPhone應用程序中的模板生成SMS消息?
親愛的[收件人姓名]
我想見到你。
此致,
[收件人姓名]
我想改變[recipient name]
給用戶發送短信的人。
我該如何生成SMS消息中要發送的字符串,以及如何發送它?
我正在嘗試製作iPhone應用程序,用戶可以使用內置模板發送短信。例如:如何根據iPhone應用程序中的模板生成SMS消息?
親愛的[收件人姓名]
我想見到你。
此致,
[收件人姓名]
我想改變[recipient name]
給用戶發送短信的人。
我該如何生成SMS消息中要發送的字符串,以及如何發送它?
如果有人在尋找我自己做過的代碼。
if(appdelegate.dataarray.count> 0)NSMutableArray * dataarrrr = [appdelegate.dataarray objectAtIndex:0]; NSLog(@「%@」,[dataarrrr objectAtIndex:0]); NSString * aa = [dataarrrr objectAtIndex:0]; NSMutableArray * myArray = [aa componentsSeparatedByString:@「,」];
NSString *n = [myArray objectAtIndex:0];
NSString *m=[myArray objectAtIndex:1];
NSString *Message = [dataarrrr objectAtIndex:1];
NSString *new = [Message stringByReplacingOccurrencesOfString: @"<Dear User>" withString:n];
controller.body = new;
controller.recipients= [NSArray arrayWithObject:m];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
請參閱MFMessageComposeViewController,您可以在顯示消息編排器之前設置SMS正文。我不認爲有更好的方式發送短信,看到這個related question。
問題是你不能在你點擊收件人的名字後改變短信的正文。我想在選擇一個我想發送短信的人之後改變短信的身體。 – 2011-01-20 08:23:39