Click here to Skip to main content
16,019,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
DESIGN: In my app, am using iMessage post option. Its works perfectly with one silly problem. Here is my code:
C#
if(!TARGET_IPHONE_SIMULATOR){
        if ([MFMessageComposeViewController canSendText]){
            MFMessageComposeViewController *MFMsgPicker = [[MFMessageComposeViewController alloc] init];
            MFMsgPicker.messageComposeDelegate = self;

            MFMsgPicker.recipients = [NSArray arrayWithObject:@""];   // your recipient number or self for testing
            MFMsgPicker.body = [NSString stringWithFormat:@"Send from my app"];

            if ([MFMessageComposeViewController canSendAttachments]) {
                // data code for attachment here. worked perfectly. so removed it.

                NSLog(@"Attachments Can Be Sent.");

                [self presentViewController:MFMsgPicker animated:YES completion:nil];
            }
            else{
                [CommonMethods alertFromCommonMethods:@"Your device doesen't support the iMessage Attachment feature!"];
                [appDelegate stopProgressLoading];
            }
        }
        else{
            [CommonMethods alertFromCommonMethods:@"Your device doesen't support the iMessage send text feature!"];
            [appDelegate stopProgressLoading];
        }
}
else{
    [CommonMethods alertFromCommonMethods:@"Your device doesen't support the iMessage"];
    [appDelegate stopProgressLoading];
}


PROBLEM:

When my app re-direct to the iMessage, the recipient field always with text "Buddy Name, ". I can edit it but why its happening!. Not only in my device and my client also facing this. And my client wants to avoid that.


Tool:
* Xcode 5.1.1
* Tested in both iPhone and iPad with iOS 8, 7. Am not following iOS 6.
Posted
Updated 11-Jan-21 4:32am
v2

It looks like it is a default value bei Apple if using an empty string. (It is something else than nil)

MFMsgPicker.recipients = nil;


worked fine.

As always: if you dont need it - dont do it.

But why arent you giving some useful value to it?
 
Share this answer
 
Comments
Md Sadham 10-Apr-15 8:19am    
Your code works. And "if you don't need it - dont do it" - Good philosophy!!!. Thanks.
For your question, we want no recipient value on that field by default. The user only fill it on manually.
Hi, I saw your query, and in my husband iPhone 13 pro phone I always keep seeing last mms(in iMessage)sent to “buddy name” but there is no contact exist with that name. Can u help?
 
Share this answer
 
Comments
OriginalGriff 23-Jan-22 1:39am    
This is not a solution to a problem and should not be posted as such.
And this is not a "tech support for Appal devices - try the Appal Store and the "genius bar".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900