아래 코드를 구현하고 arrayPlainText
을 기록했지만 시뮬레이터와 iPhone에서 실행하면 첫 번째 항목 만 표시되고 나머지는 사라졌습니다.메시지 본문의 문자열이 작동하지 않습니다.
NSMutableArray *xmlListContent;
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:[self returnListPath]])
{
xmlListContent = [[NSMutableArray alloc] initWithContentsOfFile:[self returnListPath]];
NSMutableArray *listContent = [[NSMutableArray alloc] init];
int i;
for(i = 0; i < [xmlListContent count]; i++)
{
MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
[mailComposer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
[mailComposer setSubject:editedListTitle];
[mailComposer setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
NSString *item = [NSString stringWithString:[[xmlListContent objectAtIndex:i] objectForKey:@"label"]];
NSString *tempString = [NSString stringWithFormat:@"-%@",item];
[listContent addObject:tempString];
NSString *arrayPlainText = [listContent componentsJoinedByString:@"<br>"];
[mailComposer setMessageBody:[NSString stringWithFormat:@"<html>%@</html>",arrayPlainText] isHTML:YES];
DLog(arrayPlainText);
[self presentModalViewController:mailComposer animated:YES];
}
}
}
else
{
xmlListContent = [NSMutableArray array];
DLog(@"failed to compose list via email");
}
코드를 더 제공 할 수 있습니까? 변수를 사용하여 선언을 표시하지 않습니다. –