开发者

not able to present mail compose view controller on the view

i hav a button on navigation bar for opening the mail view controller .. i am using view based app and when i tap the button its executes the ibaction i wrote but not presenting the view ....

-(IBAction)mailid:(id)sender{

 MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
 controller.mailComposeDelegate = self;

 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
 NSString *documentsDirectory = [paths objectAtIndex:0];
 NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Report.html开发者_如何学Python"];

 NSData *myData = [NSData dataWithContentsOfFile:path];

 [controller addAttachmentData:myData mimeType:@"html" fileName:@"Attachment-1"];
 [self presentModalViewController:controller animated:YES];

 [controller release];


}

any help ....


Not sure if averything else is correct, but mime type should be @"txt/html", not just @"html"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜