2

現在、私のアプリは私が望むようにメッセージを送信していますが、通常のテキスト メッセージではなくマルチメディア メッセージを送信し続けています。なぜこれを行っているのか知りたいです。以下は、メッセージを送信するための私のコードです。

-(void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSMutableArray *)recipients{
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc]init]autorelease];
if([MFMessageComposeViewController canSendText]){
    controller.body = bodyOfMessage;
    controller.recipients = recipients;
    controller.messageComposeDelegate = self;
    [self presentModalViewController:controller animated:YES];
}
}

-(void)textMessage{
NSLog(@"%@", savedPeople);
ABAddressBookRef addressBook = ABAddressBookCreate();
NSMutableArray *phoneNumberToText = [[NSMutableArray alloc]init];
for(NSString *name in savedPeople){
    if(savedPeople != nil){
        NSArray *people = (NSArray *)ABAddressBookCopyPeopleWithName(addressBook, CFStringCreateCopy(kCFAllocatorDefault, (CFStringRef)name));
        for(int i =0;i<[people count];i++){
            ABMultiValueRef person = (ABMultiValueRef)[people objectAtIndex:i];
            ABMultiValueRef phoneNumber = (NSString *)ABRecordCopyValue(person, kABPersonPhoneProperty);
            CFStringRef phoneNumberRef = ABMultiValueCopyValueAtIndex(phoneNumber, i);
            NSString *phoneNumbers = (NSString *)phoneNumberRef;
            [phoneNumberToText addObject:phoneNumbers];
        }
    }

}
NSLog(@"%@",phoneNumberToText);
[self sendSMS:@"Testing" recipientList:phoneNumberToText];


}

-(void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{
[self dismissModalViewControllerAnimated:YES];
if(result == MessageComposeResultCancelled)
    NSLog(@"Message Canceled");
else if(result == MessageComposeResultSent)
    NSLog(@"message sent");
else
    NSLog(@"message failed");
}
4

0 に答える 0