I'm assining a NSMutableArray
called "arrmIndexArray" to the property recipients of MFMessageComposeViewController like:
contoller.recipients=arrmIndexArray
But its crashing.
if([MFMessageComposeViewController canSendText]){
NSLog(@"contact page MFMessageComposeViewController canSendText");
controller.messageComposeDelegate = self
NSLog(@"get sms etxt is %@",[msmscheck getsmsText]);
controller.body =[msmscheck getsmsText];
NSLog(@"agter the getsms text");
NSLog(@"arr-- from server-->%@",arrmIndexArray);
//Crashes on this line:
controller.recipients = arrmIndexArray;
NSLog(@"recipent---%@",controller.recipients);
NSString *messag=[NSString stringWithFormat:@"message sent to %d people",[arrmIndexArray count]];
controller.editing = NO;
summary=messag;
NSLog(@"before--");
[self presentModalViewController:controller animated:YES];
开发者_JAVA技巧 NSLog(@"after-");
[controller release];
}
giving EXC_BAD_ACCESS
You should look at apples docunents about MFMailComposer. You should be using
- (void)setToRecipients:(NSArray*)toRecipients
to set the recipients. MFMailComposer Class Reference: http://developer.apple.com/library/ios/documentation/MessageUI/Reference/MFMailComposeViewController_class/Reference/Reference.html MFMailComposer sample project: http://developer.apple.com/library/ios/samplecode/MailComposer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008865
精彩评论