为什么我发送MultiMedia消息而不是短信

时间:2012-05-03 23:28:49

标签: objective-c ios xcode sms multimedia

现在我的应用程序正在发送我想要的消息,但它不断发送多媒体消息而不是常规短信。我想知道它为什么这样做。 以下是我发送消息的代码。

-(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");
}

0 个答案:

没有答案