zbyt518
2023-08-24 15:24:19 +08:00
在微信里面的话需要微信支持才行,比如文件预览之类的,在自己的 APP 里可以通过原生能力桥接实现,这玩意儿是需要有本地路径的,不是随便啥都能调起的,给你个 IOS 原生代码参考
NSDictionary *path = msg[@"path"];
NSString *localPath = path[@"localPath"];
NSURL *url = [NSURL fileURLWithPath:localPath];
NSArray *activityItems = @[ url ];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
//不出现在活动项目
activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard,UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll];
[self.webViewController presentViewController:activityVC animated:YES completion:nil];