Próbuję przekonwertować (lub skopiować?) NSMutableArray
na NSString
. Domyślam się, że mój problem to , którego naprawdę nie rozumiem struktury NSString
. Po konwersji chcę załączyć go w treści wiadomości e-mail. Oto mój kod:Jak przekonwertować NSMutableArray na NSString?
- (IBAction)sendEmail
{
NSLog(@"sendEmail");
[textView resignFirstResponder];
[textView1 resignFirstResponder];
if ([MFMailComposeViewController canSendMail])
{
// set the sendTo address
NSMutableArray *recipients = [[NSMutableArray alloc] initWithCapacity:1];
[recipients addObject:@"[email protected]"];
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Iphone Game"];
NSString *string = [string appendString:[NSString stringWithFormat:"%@", [viewArray objectAtIndex:i]]];
[controller setMessageBody:string isHTML:NO];
[controller setToRecipients:recipients];
[self presentModalViewController:controller animated:YES];
[controller release];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert"
message:@"Your device is not set up for email." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
}
Jaki jest twój problem, czy możesz wyjaśnić jednoznacznie? – Dinesh
takie same jak to: -http: //stackoverflow.com/questions/8802543/how-to-convert-nsmutablearray-into-nsstring/8802630#8802630 – Leena