2011-08-30 71 views
0

我assining問題NSMutableArray稱爲 「arrmIndexArray」 到MFMessageComposeViewController像財產收件人:messageCompose在收件人

contoller.recipients=arrmIndexArray 

但它的崩潰。

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]; 
    NSLog(@"after-"); 
    [controller release]; 
} 

給EXC_BAD_ACCESS

+1

這是什麼行'arrayWithObjects:@ 「8147042736」,零]'? – EmptyStack

+0

你怎麼能夠編譯這段代碼?它甚至不會編譯。 –

+0

thais被評論line.now刪除 – user1210691

回答

0

你應該看看關於MFMailComposer蘋果docunents。您應該使用

- (void)setToRecipients:(NSArray*)toRecipients 

設置收件人。 MFMailComposer類參考:http://developer.apple.com/library/ios/documentation/MessageUI/Reference/MFMailComposeViewController_class/Reference/Reference.html MFMailComposer樣本項目:http://developer.apple.com/library/ios/samplecode/MailComposer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008865

+0

它現在解決了。有一些內存釋放問題在那裏,secondlly有陣列我轉換成字符串使用字符串格式然後傳遞它reciepint, – user1210691

相關問題