In-App SMS with pre-written body limited to 40 characters
I am using the MFMessageComposeViewController
to send a message within the application.
Problem:
When I send the text message to a non-iPhone (e.g. Nexus One), the message is always split into two or more text messages.
But if I sent the same message directly from the native Messages app, the message is delivered in a single message.
And then I found this recently, Actually what is happening is the message body is splitting by 40 characters and I can not figure out the situation.
What could be wrong? Is ther开发者_运维问答e a work around for this?
CODE:
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
if([MFMessageComposeViewController canSendText])
{
controller.body = @"This is a sample body which is containing more than 40 characters...";
controller.recipients = phnNumbersArray;
controller.messageComposeDelegate = self;
[self.view presentModalViewController:controller animated:YES];
}
[controller release];
Never tried, but possible three workaround for this.
1) Try using [NSString stringWithFormat:@"%@", myMsgBody];
I don't think it would work / resolves the issue, most probably. :P
2) See if you can send NSUTF8StringEncoding
way.
3) Or the problem is at the carrier's side, nothing to do with your code.
Explanation: In your scenario I see the texts are breaking up into multiple texts. Servers at the carriers' site thinks your message is too long. That means too heavy to be sent at once. This basically means it's xxmb
more than what the servers takes. To reduce that size i gave you the idea of encoding way...
精彩评论