我尝试通过 UIActivityViewController 发送电子邮件并且它工作正常,但是在发送电子邮件后邮件视图不会被关闭。当用户按下取消按钮时,它也不会关闭。
我能做些什么来解决这个问题?
这是我使用的代码:
//conf share view
NSString *textToShare = @"Teststring!";
UIImage *imageToShare = fetchedImage;
NSURL *urlToShare = [NSURL URLWithString:string_url];
NSArray *activityItems = [[NSArray alloc] initWithObjects:textToShare, imageToShare,urlToShare,nil];
UIActivity *activity = [[UIActivity alloc] init];
NSArray *applicationActivities = [[NSArray alloc] initWithObjects:activity, nil];
UIActivityViewController *activityVC =
[[UIActivityViewController alloc] initWithActivityItems:activityItems
applicationActivities:applicationActivities];
activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact,
UIActivityTypePostToWeibo,
UIActivityTypeCopyToPasteboard,
UIActivityTypeSaveToCameraRoll,
UIActivityTypePrint];
[activityVC setCompletionHandler:^(NSString *activityType, BOOL completed) {
NSLog(@"CompletionHandler was called!");
}];
谢谢!