저는 iPhone 개발을 처음 사용합니다. 나는내 응용 프로그램을 통해 전자 메일을 보낼 수 없습니다.
- (IBAction)btnsendPressAction:(id)sender {
if([MFMailComposeViewController canSendMail]){
MFMailComposeViewController *mailer=[[MFMailComposeViewController alloc]init];
mailer.mailComposeDelegate=self;
[mailer setSubject:@"A Message for testing"];
NSArray *toRecipients = [NSArray arrayWithObjects:@"[email protected]", @"[email protected]", nil];
[mailer setToRecipients:toRecipients];
UIImage *image=[UIImage imageNamed:@"logo.png"];
NSData *imageData=UIImagePNGRepresentation(image);
[mailer addAttachmentData:imageData mimeType:@"image/png" fileName:@"logo.png"];
NSString *[email protected]"This is test email";
[mailer setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:mailer animated:YES];
mailer.modalPresentationStyle = UIModalPresentationPageSheet ;
}
else{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"failure" message:@"Alert" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
}
내 문제는 대리인이 전화 받고되지 mailComposeController 내가 통해 이메일을 보낼 수 없습니다입니다 내 app.I 겪은 다음 코드를 사용하고 내가 email.I을 보낼 수있는 응용 프로그램을 건물입니다 많은 링크가 있지만, 모든 곳에서 같은 방법을 발견했습니다. 아무도 이것에 나를 도울 수 있습니까?
위임자를위한 적절한 메서드를 내 코드에 추가했습니다.이 코드는 여기에 넣지 않았습니다. – Raj
사용중인 장치에 메일 ID가 구성되어 있는지 확인하십시오. – Dhruv
시뮬레이터를 테스트하고 구성하는 방법을 알고 있습니까? – Raj